mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
tweaked the loader -- needs refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f204503464
commit
70a5d4fe26
@ -599,19 +599,26 @@ actions.Actions({
|
|||||||
// actions if that info is needed.
|
// actions if that info is needed.
|
||||||
// NOTE: to make things clean, this is triggered in action handlers
|
// NOTE: to make things clean, this is triggered in action handlers
|
||||||
// below...
|
// below...
|
||||||
|
// XXX do we need a vertical shift event??
|
||||||
shiftImage: ['- Interface/Image shift (do not use directly)',
|
shiftImage: ['- Interface/Image shift (do not use directly)',
|
||||||
core.notUserCallable(function(gid){
|
core.notUserCallable(function(gid){
|
||||||
// This is the image shift protocol root function
|
// This is the image shift protocol root function
|
||||||
//
|
//
|
||||||
// Not for direct use.
|
// Not for direct use.
|
||||||
})],
|
})],
|
||||||
|
shiftImageOrder: ['- Interface/Image horizontal shift (do not use directly)',
|
||||||
|
core.notUserCallable(function(gid){
|
||||||
|
// This is the image shift protocol root function
|
||||||
|
//
|
||||||
|
// Not for direct use.
|
||||||
|
})],
|
||||||
|
|
||||||
// XXX to be used for things like mark/place and dragging...
|
// XXX to be used for things like mark/place and dragging...
|
||||||
// XXX revise...
|
// XXX revise...
|
||||||
// XXX undo...
|
// XXX undo...
|
||||||
shiftImageTo: ['- Edit|Sort|Image/',
|
shiftImageTo: ['- Edit|Sort|Image/',
|
||||||
{undo: function(a){ this.shiftImageTo(a.args[1], a.args[0]) }},
|
{undo: function(a){ this.shiftImageTo(a.args[1], a.args[0]) }},
|
||||||
function(target, to){ this.data.shiftImageTo(target, to) }],
|
function(target, to){ this.data.shiftImage(target, to) }],
|
||||||
|
|
||||||
shiftImageUp: ['Edit|Image/Shift image up',
|
shiftImageUp: ['Edit|Image/Shift image up',
|
||||||
'If implicitly shifting current image (i.e. no arguments), focus '
|
'If implicitly shifting current image (i.e. no arguments), focus '
|
||||||
@ -862,6 +869,19 @@ module.Base = core.ImageGridFeatures.Feature({
|
|||||||
'shiftImageRight',
|
'shiftImageRight',
|
||||||
],
|
],
|
||||||
function(){ this.shiftImage.apply(this, [].slice(arguments, 1))}],
|
function(){ this.shiftImage.apply(this, [].slice(arguments, 1))}],
|
||||||
|
// horizontal shifting...
|
||||||
|
[[
|
||||||
|
'shiftImageLeft',
|
||||||
|
'shiftImageRight',
|
||||||
|
],
|
||||||
|
function(){ this.shiftImageOrder.apply(this, [].slice(arguments, 1))}],
|
||||||
|
['shiftImageTo.pre',
|
||||||
|
function(a){
|
||||||
|
var i = this.data.getImageOrder(a)
|
||||||
|
return function(){
|
||||||
|
// only trigger if order changed...
|
||||||
|
i != this.data.getImageOrder(a)
|
||||||
|
&& this.shiftImageOrder.apply(this, [].slice(arguments, 1)) } }],
|
||||||
|
|
||||||
// manage changes...
|
// manage changes...
|
||||||
// everything changed...
|
// everything changed...
|
||||||
|
|||||||
@ -391,7 +391,7 @@ module.SortActions = actions.Actions({
|
|||||||
if(order){
|
if(order){
|
||||||
this.data.order = order.slice()
|
this.data.order = order.slice()
|
||||||
this.sortImages('update' + (reverse ? ' reverse' : ''))
|
this.sortImages('update' + (reverse ? ' reverse' : ''))
|
||||||
this.data.sort_method = mode
|
this.data.sort_method = title
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
@ -409,7 +409,8 @@ module.SortActions = actions.Actions({
|
|||||||
|
|
||||||
// Store/load sort data:
|
// Store/load sort data:
|
||||||
// .data.sort_method - current sort mode (optional)
|
// .data.sort_method - current sort mode (optional)
|
||||||
// .data.sort_cache - manual sort order (optional)
|
// .data.sort_order - saved sort order (optional)
|
||||||
|
// .data.sort_cache - cached sort order (optional)
|
||||||
load: [function(data){
|
load: [function(data){
|
||||||
return function(){
|
return function(){
|
||||||
if(data.data && data.data.sort_method){
|
if(data.data && data.data.sort_method){
|
||||||
@ -493,6 +494,15 @@ module.Sort = core.ImageGridFeatures.Feature({
|
|||||||
// manage changes...
|
// manage changes...
|
||||||
['sortImages',
|
['sortImages',
|
||||||
function(_, target){ this.markChanged('data') }],
|
function(_, target){ this.markChanged('data') }],
|
||||||
|
// NOTE: this always saves to 'Manual' this is correct regardless
|
||||||
|
// of save mode as in the current logic, the only mode that
|
||||||
|
// results from a manual shift is a manual sort...
|
||||||
|
// XXX this may pose a problem with saved sorts, the question
|
||||||
|
// is whether a saved mode can be edited or just saved or
|
||||||
|
// updated...
|
||||||
|
['shiftImageOrder',
|
||||||
|
function(){ this.markChanged('sort_order', ['Manual']) }],
|
||||||
|
|
||||||
['saveOrder',
|
['saveOrder',
|
||||||
function(_, title){ this.markChanged('sort_order', [title]) }],
|
function(_, title){ this.markChanged('sort_order', [title]) }],
|
||||||
['cacheOrder',
|
['cacheOrder',
|
||||||
|
|||||||
@ -2587,6 +2587,7 @@ var DataPrototype = {
|
|||||||
// load initial state...
|
// load initial state...
|
||||||
if(json != null){
|
if(json != null){
|
||||||
this.loadJSON(json)
|
this.loadJSON(json)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this._reset()
|
this._reset()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -827,6 +827,15 @@ module.buildIndex = function(index, base_path){
|
|||||||
img.forEach(function(_, img){ img.base_path = base_path })
|
img.forEach(function(_, img){ img.base_path = base_path })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extra stuff...
|
||||||
|
// ...this will restore stuff stored in the data but not explicitly
|
||||||
|
// restored above...
|
||||||
|
Object.keys(index.data).forEach(function(k){
|
||||||
|
if(d[k] === undefined){
|
||||||
|
d[k] = index.data[k]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
res.data = d
|
res.data = d
|
||||||
res.images = img
|
res.images = img
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user