diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index 6050acb2..5240bf3b 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -805,6 +805,9 @@ module.CropActions = actions.Actions({ }) } }], + clear: [function(){ + delete this.crop_stack }], + // store the root crop state instead of the current view... // // modes supported: @@ -841,11 +844,6 @@ module.CropActions = actions.Actions({ // crop: ['- Crop/Crop image list', function(list, flatten){ - if(this.data.length == 0){ - return - } - - //list = list || this.data.order list = list || this.data.getImages() if(this.crop_stack == null){ @@ -917,9 +915,12 @@ module.CropActions = actions.Actions({ // XXX not sure if we actually need this... cropFlatten: ['Crop/Flatten', - function(list){ this.crop(list, true) }], + function(list){ this.data.length > 0 && this.crop(list, true) }], cropRibbon: ['Crop/Crop current ribbon', function(ribbon, flatten){ + if(this.data.length == 0){ + return + } if(typeof(ribbon) == typeof(true)){ flatten = ribbon ribbon = null @@ -929,6 +930,9 @@ module.CropActions = actions.Actions({ }], cropRibbonAndAbove: ['Crop/Crop out ribbons bellow', function(ribbon, flatten){ + if(this.data.length == 0){ + return + } if(typeof(ribbon) == typeof(true)){ flatten = ribbon ribbon = null @@ -955,6 +959,9 @@ module.CropActions = actions.Actions({ // XXX should this be here??? cropTagged: ['Tag|Crop/Crop tagged images', function(tags, mode, flatten){ + if(this.data.length == 0){ + return + } var selector = mode == 'any' ? 'getTaggedByAny' : 'getTaggedByAll' this.crop(this.data[selector](tags), flatten) }], diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index 86a83581..274ab2b3 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -83,7 +83,10 @@ function(attr, states, a, b){ var ImageGridMetaActions = module.ImageGridMetaActions = { // XXX experimental... - get data(){ return this.__data || data.Data() }, + get data(){ + var d = this.__data = this.__data || data.Data() + return d + }, set data(value){ this.__data = value }, // Test if the action is a Toggler... diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index b9b61781..305893ee 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1203,14 +1203,15 @@ module.Buttons = core.ImageGridFeatures.Feature({ this.toggleSecondaryButtons(this.config['secondary-buttons-state'] || 'on') this.toggleSideButtons(this.config['side-buttons-state'] || 'on') }], - ['load reload', + + // update crop button status... + ['load clear reload', function(){ - // update crop button status... $('.main-buttons.buttons .crop.button sub') .text(this.crop_stack ? this.crop_stack.length : '') }], + // update zoom button status... ['setScale', function(){ - // update crop button status... $('.secondary-buttons.buttons .zoom.button sub') .text(Math.round(this.screenwidth)) }], ],