From 568757f9f1f49626cf18ef194f2a6a2cda1525a8 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 23 Oct 2019 16:12:53 +0300 Subject: [PATCH] rewritten part of the crop mechanics... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/virtual-blocks.js | 32 +++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/ui (gen4)/features/virtual-blocks.js b/ui (gen4)/features/virtual-blocks.js index 82bca9fe..74c1b7ab 100644 --- a/ui (gen4)/features/virtual-blocks.js +++ b/ui (gen4)/features/virtual-blocks.js @@ -38,6 +38,21 @@ var widgets = require('features/ui-widgets') // // var VirtualBlocksActions = actions.Actions({ + + // XXX do we need to pre-cache this??? + get virtual(){ + var that = this + return this.data.order + .filter(function(gid){ + img = that.images[gid] || {} + return img.type == 'virtual' }) }, + get nonVirtual(){ + var that = this + return this.data.order + .filter(function(gid){ + img = that.images[gid] || {} + return img.type != 'virtual' }) }, + // construction of new "virtual images"... // // XXX add undo... @@ -154,29 +169,26 @@ var VirtualBlocksActions = actions.Actions({ this.makeVirtualBlock(ref, offset, img) }], // crop... - cropVirtualBlocks: ['Virtual block|Crop/Crop virtual blocks', + cropVirtualBlocks: ['Virtual block|Crop/$Crop $virtual blocks', core.doc`Crop virtual blocks... - Crop virtual blocks... + Crop (keep) virtual blocks... .cropVirtualBlocks() .cropVirtualBlocks('keep') -> this - Crop virtiual bloks out... + Crop virtual 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' })) }], + return this.crop( + mode == 'keep' ? + this.virtual + : this.nonVirtual) }], cropVirtualBlocksOut: ['Virtual block|Crop/Crop virtual blocks out', { browseMode: 'cropVirtualBlocks' }, 'cropVirtualBlocks: "skip"'],