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...
|
// store the root crop state instead of the current view...
|
||||||
//
|
//
|
||||||
// modes supported:
|
// modes supported:
|
||||||
@ -841,11 +844,6 @@ module.CropActions = actions.Actions({
|
|||||||
//
|
//
|
||||||
crop: ['- Crop/Crop image list',
|
crop: ['- Crop/Crop image list',
|
||||||
function(list, flatten){
|
function(list, flatten){
|
||||||
if(this.data.length == 0){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//list = list || this.data.order
|
|
||||||
list = list || this.data.getImages()
|
list = list || this.data.getImages()
|
||||||
|
|
||||||
if(this.crop_stack == null){
|
if(this.crop_stack == null){
|
||||||
@ -917,9 +915,12 @@ module.CropActions = actions.Actions({
|
|||||||
|
|
||||||
// XXX not sure if we actually need this...
|
// XXX not sure if we actually need this...
|
||||||
cropFlatten: ['Crop/Flatten',
|
cropFlatten: ['Crop/Flatten',
|
||||||
function(list){ this.crop(list, true) }],
|
function(list){ this.data.length > 0 && this.crop(list, true) }],
|
||||||
cropRibbon: ['Crop/Crop current ribbon',
|
cropRibbon: ['Crop/Crop current ribbon',
|
||||||
function(ribbon, flatten){
|
function(ribbon, flatten){
|
||||||
|
if(this.data.length == 0){
|
||||||
|
return
|
||||||
|
}
|
||||||
if(typeof(ribbon) == typeof(true)){
|
if(typeof(ribbon) == typeof(true)){
|
||||||
flatten = ribbon
|
flatten = ribbon
|
||||||
ribbon = null
|
ribbon = null
|
||||||
@ -929,6 +930,9 @@ module.CropActions = actions.Actions({
|
|||||||
}],
|
}],
|
||||||
cropRibbonAndAbove: ['Crop/Crop out ribbons bellow',
|
cropRibbonAndAbove: ['Crop/Crop out ribbons bellow',
|
||||||
function(ribbon, flatten){
|
function(ribbon, flatten){
|
||||||
|
if(this.data.length == 0){
|
||||||
|
return
|
||||||
|
}
|
||||||
if(typeof(ribbon) == typeof(true)){
|
if(typeof(ribbon) == typeof(true)){
|
||||||
flatten = ribbon
|
flatten = ribbon
|
||||||
ribbon = null
|
ribbon = null
|
||||||
@ -955,6 +959,9 @@ module.CropActions = actions.Actions({
|
|||||||
// XXX should this be here???
|
// XXX should this be here???
|
||||||
cropTagged: ['Tag|Crop/Crop tagged images',
|
cropTagged: ['Tag|Crop/Crop tagged images',
|
||||||
function(tags, mode, flatten){
|
function(tags, mode, flatten){
|
||||||
|
if(this.data.length == 0){
|
||||||
|
return
|
||||||
|
}
|
||||||
var selector = mode == 'any' ? 'getTaggedByAny' : 'getTaggedByAll'
|
var selector = mode == 'any' ? 'getTaggedByAny' : 'getTaggedByAll'
|
||||||
this.crop(this.data[selector](tags), flatten)
|
this.crop(this.data[selector](tags), flatten)
|
||||||
}],
|
}],
|
||||||
|
|||||||
@ -83,7 +83,10 @@ function(attr, states, a, b){
|
|||||||
var ImageGridMetaActions =
|
var ImageGridMetaActions =
|
||||||
module.ImageGridMetaActions = {
|
module.ImageGridMetaActions = {
|
||||||
// XXX experimental...
|
// 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 },
|
set data(value){ this.__data = value },
|
||||||
|
|
||||||
// Test if the action is a Toggler...
|
// 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.toggleSecondaryButtons(this.config['secondary-buttons-state'] || 'on')
|
||||||
this.toggleSideButtons(this.config['side-buttons-state'] || 'on')
|
this.toggleSideButtons(this.config['side-buttons-state'] || 'on')
|
||||||
}],
|
}],
|
||||||
['load reload',
|
|
||||||
|
// update crop button status...
|
||||||
|
['load clear reload',
|
||||||
function(){
|
function(){
|
||||||
// update crop button status...
|
|
||||||
$('.main-buttons.buttons .crop.button sub')
|
$('.main-buttons.buttons .crop.button sub')
|
||||||
.text(this.crop_stack ? this.crop_stack.length : '') }],
|
.text(this.crop_stack ? this.crop_stack.length : '') }],
|
||||||
|
// update zoom button status...
|
||||||
['setScale',
|
['setScale',
|
||||||
function(){
|
function(){
|
||||||
// update crop button status...
|
|
||||||
$('.secondary-buttons.buttons .zoom.button sub')
|
$('.secondary-buttons.buttons .zoom.button sub')
|
||||||
.text(Math.round(this.screenwidth)) }],
|
.text(Math.round(this.screenwidth)) }],
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user