mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added browse action predicates to more actions...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
37f089cc91
commit
f1c4d558ea
@ -1031,6 +1031,8 @@ module.ImageGroupActions = actions.Actions({
|
|||||||
group: ['- Group|Edit/Group images',
|
group: ['- Group|Edit/Group images',
|
||||||
function(gids, group){ this.data.group(gids, group) }],
|
function(gids, group){ this.data.group(gids, group) }],
|
||||||
ungroup: ['Group|Edit/Ungroup images',
|
ungroup: ['Group|Edit/Ungroup images',
|
||||||
|
{browseMode: function(){
|
||||||
|
return this.data.getGroup() == null && 'disabled' }},
|
||||||
function(gids, group){ this.data.ungroup(gids, group) }],
|
function(gids, group){ this.data.ungroup(gids, group) }],
|
||||||
|
|
||||||
// direction can be:
|
// direction can be:
|
||||||
@ -1066,11 +1068,17 @@ module.ImageGroupActions = actions.Actions({
|
|||||||
function(){ this.group(this.data.getImages(this.data.getTaggedByAny('marked'))) }],
|
function(){ this.group(this.data.getImages(this.data.getTaggedByAny('marked'))) }],
|
||||||
|
|
||||||
expandGroup: ['Group/Expand group',
|
expandGroup: ['Group/Expand group',
|
||||||
|
{browseMode: function(){
|
||||||
|
return this.data.getGroup() == null && 'disabled' }},
|
||||||
function(target){ this.data.expandGroup(target || this.current) }],
|
function(target){ this.data.expandGroup(target || this.current) }],
|
||||||
collapseGroup: ['Group/Collapse group',
|
collapseGroup: ['Group/Collapse group',
|
||||||
|
{browseMode: function(){
|
||||||
|
return this.data.getGroup() == null && 'disabled' }},
|
||||||
function(target){ this.data.collapseGroup(target || this.current) }],
|
function(target){ this.data.collapseGroup(target || this.current) }],
|
||||||
|
|
||||||
cropGroup: ['Crop|Group/Crop group',
|
cropGroup: ['Crop|Group/Crop group',
|
||||||
|
{browseMode: function(){
|
||||||
|
return this.data.getGroup() == null && 'disabled' }},
|
||||||
function(target){ this.crop(this.data.cropGroup(target || this.current)) }],
|
function(target){ this.crop(this.data.cropGroup(target || this.current)) }],
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1273,6 +1281,8 @@ module.Journal = core.ImageGridFeatures.Feature({
|
|||||||
// .redoLast(..)
|
// .redoLast(..)
|
||||||
// XXX this is not ready for production...
|
// XXX this is not ready for production...
|
||||||
undoLast: ['Edit/Undo last',
|
undoLast: ['Edit/Undo last',
|
||||||
|
{browseMode: function(){
|
||||||
|
return (this.journal && this.journal.length > 0) || 'disabled' }},
|
||||||
function(){
|
function(){
|
||||||
var journal = this.journal
|
var journal = this.journal
|
||||||
this.rjournal = (this.hasOwnProperty('rjournal')
|
this.rjournal = (this.hasOwnProperty('rjournal')
|
||||||
@ -1296,7 +1306,9 @@ module.Journal = core.ImageGridFeatures.Feature({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
_redoLast: ['Edit/Redo last',
|
redoLast: ['Edit/Redo last',
|
||||||
|
{browseMode: function(){
|
||||||
|
return (this.rjournal && this.rjournal.length > 0) || 'disabled' }},
|
||||||
function(){
|
function(){
|
||||||
if(!this.rjournal || this.rjournal.length == 0){
|
if(!this.rjournal || this.rjournal.length == 0){
|
||||||
return
|
return
|
||||||
|
|||||||
@ -798,6 +798,8 @@ module.ViewerActions = actions.Actions({
|
|||||||
// Zooming is done by multiplying the current scale by .config['zoom-step']
|
// Zooming is done by multiplying the current scale by .config['zoom-step']
|
||||||
// and rounding to nearest discrete number of images to fit on screen.
|
// and rounding to nearest discrete number of images to fit on screen.
|
||||||
zoomIn: ['Zoom/Zoom in',
|
zoomIn: ['Zoom/Zoom in',
|
||||||
|
{browseMode: function(){
|
||||||
|
return Math.min(this.screenwidth, this.screenheight) <= 1 && 'disabled' }},
|
||||||
function(){
|
function(){
|
||||||
var d = (this.config['zoom-step'] || 1.2)
|
var d = (this.config['zoom-step'] || 1.2)
|
||||||
|
|
||||||
@ -811,6 +813,8 @@ module.ViewerActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
zoomOut: ['Zoom/Zoom out',
|
zoomOut: ['Zoom/Zoom out',
|
||||||
|
{browseMode: function(){
|
||||||
|
return this.screenwidth >= this.config['max-screen-images'] && 'disabled' }},
|
||||||
function(){
|
function(){
|
||||||
var max = this.config['max-screen-images']
|
var max = this.config['max-screen-images']
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user