mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
more cleanup and refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1bb34d8d60
commit
a4d4fe949f
@ -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)
|
||||
}],
|
||||
|
||||
@ -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...
|
||||
|
||||
@ -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)) }],
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user