more cleanup and refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-11-28 20:18:34 +03:00
parent 1bb34d8d60
commit a4d4fe949f
3 changed files with 21 additions and 10 deletions

View File

@ -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)
}],

View File

@ -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...

View File

@ -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',
function(){
// update crop button status...
['load clear reload',
function(){
$('.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)) }],
],