tweaking and minor refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-29 05:27:31 +03:00
parent 89741b9e95
commit 11b9351e06
4 changed files with 24 additions and 14 deletions

View File

@ -130,14 +130,6 @@ var FileSystemLoaderActions = actions.Actions({
'load-first-index-only': false,
},
clone: [function(full){
return function(res){
if(this.location){
res.__location = JSON.parse(JSON.stringify(this.__location))
}
}
}],
// XXX should this be more general???
reloadState: ['File/Reload viewer state...',
function(){
@ -328,6 +320,9 @@ var FileSystemLoaderActions = actions.Actions({
})
*/
.on('end', function(lst){
// XXX might be a good idea to make image paths relative to path...
//lst = lst.map(function(p){ return pathlib.relative(base, p) })
that.loadURLs(lst, path)
// XXX do we need to normalize paths after we get them from glob??
//that.loadURLs(lst.map(pathlib.posix.normalize), path)
@ -456,10 +451,6 @@ var FileSystemLoaderActions = actions.Actions({
logger && logger.emit('loaded', lst)
})
}],
clear: [function(){
delete this.__location
}],
})

View File

@ -110,6 +110,24 @@ module.Location = core.ImageGridFeatures.Feature({
actions: LocationActions,
handlers: [
['clone',
function(res){
if(this.location){
res.__location = JSON.parse(JSON.stringify(this.__location))
}
}],
['clear',
function(){
delete this.__location
}],
// 1) store .location
// 2) cleanup .images[..].base_path
//
// XXX might be good to make the .base_path relative to location
// if possible...
// XXX not sure if this is the right place for .images[..].base_path
// handling...
['json',
function(res){
if(this.location){

View File

@ -333,7 +333,7 @@ module.ImagesClassPrototype = {
ext: name[1],
}
// remove only of base path is given and in path...
// remove only if base path is given and in path...
if(base && base_pattern.test(path)){
images[gid].base_path = base
}

View File

@ -1084,7 +1084,8 @@ var BrowserPrototype = {
// select the item...
if(selection){
that.select(selection)
//that.select(selection)
that.select('"'+ selection +'"')
}
// maintain focus within the widget...