mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added ability to remove images from crop (experimental) + some cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2a22cd975c
commit
f2019c85aa
@ -1718,22 +1718,52 @@ module.CropActions = actions.Actions({
|
|||||||
this.crop(this.data[selector](tags), flatten)
|
this.crop(this.data[selector](tags), flatten)
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
||||||
// crop edit actions...
|
// crop edit actions...
|
||||||
// XXX
|
// XXX do we need this???
|
||||||
removeFromCrop: ['- Crop/',
|
removeFromCrop: ['Crop/Remove from crop',
|
||||||
|
{browseMode: 'uncrop'},
|
||||||
function(gids){
|
function(gids){
|
||||||
|
var that = this
|
||||||
if(!this.cropped){
|
if(!this.cropped){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var data = this.data
|
||||||
|
var current = this.current
|
||||||
|
var focus = false
|
||||||
|
|
||||||
gids = arguments.length > 1 ? [].slice.call(arguments) : gids
|
gids = arguments.length > 1 ? [].slice.call(arguments) : gids
|
||||||
gids = gids || 'current'
|
gids = gids || 'current'
|
||||||
gids = gids instanceof Array ? gids : [gids]
|
gids = gids instanceof Array ? gids : [gids]
|
||||||
|
|
||||||
gids = this.data.normalizeGIDs(gids)
|
gids
|
||||||
|
// clear ribbons...
|
||||||
|
.filter(function(gid){
|
||||||
|
if(gid in data.ribbons){
|
||||||
|
delete data.ribbons[gid]
|
||||||
|
data.ribbon_order.splice(data.ribbon_order.indexOf(gid), 1)
|
||||||
|
|
||||||
// XXX
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
// clear images...
|
||||||
|
.forEach(function(gid){
|
||||||
|
gid = data.getImage(gid)
|
||||||
|
|
||||||
|
delete data.ribbons[data.getRibbon(gid)][data.order.indexOf(gid)]
|
||||||
|
|
||||||
|
if(gid == current){
|
||||||
|
focus = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// the above may result in empty ribbons -> cleanup...
|
||||||
|
this.data.clear('empty')
|
||||||
|
|
||||||
|
// restore correct focus...
|
||||||
|
focus
|
||||||
|
&& this.focusImage(this.direction == 'left' ? 'prev' : 'next')
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,9 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
|
|
||||||
W: 'testAction2 -- XXX DEBUG: remove when done...',
|
W: 'testAction2 -- XXX DEBUG: remove when done...',
|
||||||
|
|
||||||
// XXX should we add image level manipulation here, like "remove image"???
|
// XXX not sure about this...
|
||||||
|
Del: 'removeFromCrop',
|
||||||
|
shift_Del: 'removeMarkedFromCrop',
|
||||||
},
|
},
|
||||||
|
|
||||||
'Collection': {
|
'Collection': {
|
||||||
@ -143,6 +145,7 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
Esc: 'loadCollection: "ALL" -- Load all images',
|
Esc: 'loadCollection: "ALL" -- Load all images',
|
||||||
|
|
||||||
Del: 'uncollect',
|
Del: 'uncollect',
|
||||||
|
shift_Del: 'uncollectMarked',
|
||||||
},
|
},
|
||||||
|
|
||||||
'Range': {
|
'Range': {
|
||||||
|
|||||||
@ -240,6 +240,11 @@ var ImageMarkActions = actions.Actions({
|
|||||||
{browseMode: function(target){
|
{browseMode: function(target){
|
||||||
return this.marked.length == 0 && 'disabled' }},
|
return this.marked.length == 0 && 'disabled' }},
|
||||||
function(flatten){ this.cropTagged('selected', 'any', flatten) }],
|
function(flatten){ this.cropTagged('selected', 'any', flatten) }],
|
||||||
|
|
||||||
|
removeMarkedFromCrop: ['Mark|Crop/Remove marked from crop',
|
||||||
|
{browseMode: function(target){
|
||||||
|
return (this.marked.length == 0 || !this.cropped) && 'disabled' }},
|
||||||
|
function(){ this.removeFromCrop(this.marked) }],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -561,6 +561,7 @@ core.ImageGridFeatures.Feature({
|
|||||||
'collapseGroup',
|
'collapseGroup',
|
||||||
'crop',
|
'crop',
|
||||||
'uncrop',
|
'uncrop',
|
||||||
|
'removeFromCrop',
|
||||||
],
|
],
|
||||||
function(target){ return this.reload(true) }],
|
function(target){ return this.reload(true) }],
|
||||||
[[
|
[[
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user