mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added v-block cropping...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
d6b64b2708
commit
73ce4f4a30
@ -81,6 +81,7 @@ var VirtualBlocksActions = actions.Actions({
|
|||||||
...
|
...
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
{ browseMode: function(){ return !this.collection && 'disabled' }, },
|
||||||
function(ref, offset, img){
|
function(ref, offset, img){
|
||||||
ref = ref || 'current'
|
ref = ref || 'current'
|
||||||
offset = offset || 'after'
|
offset = offset || 'after'
|
||||||
@ -132,7 +133,7 @@ var VirtualBlocksActions = actions.Actions({
|
|||||||
core.doc`
|
core.doc`
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ browseMode: function(){ return !this.collection && 'disabled' }, },
|
{ browseMode: 'makeVirtualBlock' },
|
||||||
function(ref, offset){
|
function(ref, offset){
|
||||||
this.makeVirtualBlock(ref, offset, {
|
this.makeVirtualBlock(ref, offset, {
|
||||||
type: 'virtual',
|
type: 'virtual',
|
||||||
@ -143,13 +144,42 @@ var VirtualBlocksActions = actions.Actions({
|
|||||||
'makeVirtualBlank: $0 "before"'],
|
'makeVirtualBlank: $0 "before"'],
|
||||||
|
|
||||||
cloneVirtualBlock: ['Virtual block/80:$Clone block...',
|
cloneVirtualBlock: ['Virtual block/80:$Clone block...',
|
||||||
{ browseMode: 'editVirtualBlock' },
|
{ browseMode: function(){
|
||||||
|
return (this.image || {}).type != 'virtual' && 'disabled' }, },
|
||||||
function(ref, offset, img){
|
function(ref, offset, img){
|
||||||
var img = Object.assign({},
|
var img = Object.assign({},
|
||||||
this.images[this.data.getImage(ref)] || {},
|
this.images[this.data.getImage(ref)] || {},
|
||||||
img || {})
|
img || {})
|
||||||
delete img.gid
|
delete img.gid
|
||||||
this.makeVirtualBlock(ref, offset, img) }],
|
this.makeVirtualBlock(ref, offset, img) }],
|
||||||
|
|
||||||
|
// crop...
|
||||||
|
cropVirtualBlocks: ['Virtual block|Crop/Crop virtual blocks',
|
||||||
|
core.doc`Crop virtual blocks...
|
||||||
|
|
||||||
|
Crop virtual blocks...
|
||||||
|
.cropVirtualBlocks()
|
||||||
|
.cropVirtualBlocks('keep')
|
||||||
|
-> this
|
||||||
|
|
||||||
|
Crop virtiual bloks out...
|
||||||
|
.cropVirtualBlocks('skip')
|
||||||
|
-> this
|
||||||
|
|
||||||
|
`,
|
||||||
|
{ browseMode: 'makeVirtualBlock' },
|
||||||
|
function(mode){
|
||||||
|
var that = this
|
||||||
|
mode = mode || 'keep'
|
||||||
|
return this.crop(this.data.order
|
||||||
|
.filter(function(gid){
|
||||||
|
img = that.images[gid] || {}
|
||||||
|
return mode == 'keep' ?
|
||||||
|
img.type == 'virtual'
|
||||||
|
: img.type != 'virtual' })) }],
|
||||||
|
cropVirtualBlocksOut: ['Virtual block|Crop/Crop virtual blocks out',
|
||||||
|
{ browseMode: 'cropVirtualBlocks' },
|
||||||
|
'cropVirtualBlocks: "skip"'],
|
||||||
})
|
})
|
||||||
|
|
||||||
var VirtualBlocks =
|
var VirtualBlocks =
|
||||||
@ -326,8 +356,7 @@ var VirtualBlocksEditUIActions = actions.Actions({
|
|||||||
// XXX should we also add a preview (preview constructor from features/metadata.js)???
|
// XXX should we also add a preview (preview constructor from features/metadata.js)???
|
||||||
// XXX should we do a sanity check for image type???
|
// XXX should we do a sanity check for image type???
|
||||||
editVirtualBlock: ['Virtual block/$Edit...',
|
editVirtualBlock: ['Virtual block/$Edit...',
|
||||||
{ browseMode: function(){
|
{ browseMode: 'cloneVirtualBlock' },
|
||||||
return (this.image || {}).type != 'virtual' && 'disabled' }, },
|
|
||||||
widgets.makeUIDialog(function(gid){
|
widgets.makeUIDialog(function(gid){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user