mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
some fixes + more work on the loader...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
73b52b347c
commit
c8b653567a
@ -759,6 +759,7 @@ stretching in width... */
|
||||
background: blue;
|
||||
left: -25px;
|
||||
}
|
||||
.marks-visible.single-image-mode.viewer .mark:before,
|
||||
.marks-visible.single-image-mode.viewer .mark:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -777,6 +777,7 @@ stretching in width... */
|
||||
background: blue;
|
||||
left: -25px;
|
||||
}
|
||||
.marks-visible.single-image-mode.viewer .mark:before,
|
||||
.marks-visible.single-image-mode.viewer .mark:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -19,6 +19,9 @@ console.log('>>> file')
|
||||
|
||||
//var DEBUG = DEBUG != null ? DEBUG : true
|
||||
|
||||
var data = require('data')
|
||||
var images = require('images')
|
||||
|
||||
var tasks = require('lib/tasks')
|
||||
|
||||
|
||||
@ -404,6 +407,49 @@ function(base, previews, absolute_path){
|
||||
|
||||
|
||||
|
||||
// XXX move this to a better spot...
|
||||
var buildIndex =
|
||||
module.buildIndex = function(index, base){
|
||||
var d = data.Data.fromJSON(index.data)
|
||||
|
||||
// buildup the data object...
|
||||
d.tags = d.tags || {}
|
||||
d.tags.bookmark = index.bookmarked ? index.bookmarked[0] : []
|
||||
d.tags.selected = index.marked || []
|
||||
d.sortTags()
|
||||
|
||||
// current...
|
||||
d.current = index.current || d.current
|
||||
|
||||
|
||||
// images...
|
||||
// XXX there seems to be a problem with updated images...
|
||||
// - in the test set not all rotated manually images are loaded rotated...
|
||||
var img = images.Images(index.images)
|
||||
|
||||
if(base){
|
||||
d.base_path = base
|
||||
// XXX STUB remove ASAP...
|
||||
// ...need a real way to handle base dir, possible
|
||||
// approaches:
|
||||
// 1) .base attr in image, set on load and
|
||||
// do not save (or ignore on load)...
|
||||
// if exists prepend to all paths...
|
||||
// - more to do in view-time
|
||||
// + more flexible
|
||||
// 2) add/remove on load/save (approach below)
|
||||
// + less to do in real time
|
||||
// - more processing on load/save
|
||||
img.forEach(function(_, img){ img.base = base })
|
||||
}
|
||||
|
||||
return {
|
||||
data: d,
|
||||
images: img,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
// Writer...
|
||||
|
||||
@ -85,6 +85,7 @@ function(data){
|
||||
res.order = data.order.slice()
|
||||
res.ribbon_order = data.ribbon_order == null ? [] : data.ribbon_order.slice()
|
||||
res.ribbons = {}
|
||||
|
||||
// generate gids...
|
||||
// NOTE: this will use the structures stored in data if available,
|
||||
// otherwise new structures will be generated...
|
||||
@ -98,6 +99,7 @@ function(data){
|
||||
res.ribbon_order.push(gid)
|
||||
res.ribbons[gid] = data.ribbons[k].slice()
|
||||
})
|
||||
|
||||
// we set the base to the first ribbon...
|
||||
res.base = data.base == null ? res.ribbon_order[0] : res.base
|
||||
return res
|
||||
|
||||
@ -19,7 +19,7 @@ body {
|
||||
}
|
||||
|
||||
/* show image gid... */
|
||||
.image:after {
|
||||
.visible-gid .image:after {
|
||||
content: attr(gid);
|
||||
display: block;
|
||||
position: relative;
|
||||
|
||||
@ -65,6 +65,15 @@ function makeConstructor(name, a, b){
|
||||
|
||||
|
||||
// super equivalent...
|
||||
//
|
||||
// Example:
|
||||
// superMethod(<class>, <method-name>).call(this, ...)
|
||||
// -> <result>
|
||||
//
|
||||
// This will return a next method in inheritance chain after <class> by
|
||||
// its name (<method-name>).
|
||||
// In the normal use-case <class> is the current class and <method-name>
|
||||
// is the name of the current method.
|
||||
var superMethod =
|
||||
module.superMethod =
|
||||
function superMethod(cls, meth){
|
||||
|
||||
@ -125,6 +125,11 @@ if(typeof(glob) != 'undefined'){
|
||||
}
|
||||
|
||||
|
||||
window.loadMBFWR1 = function(){
|
||||
a.loadPath('L:/mnt/hdd15 (photo)/NTFS2/media/img/my/work/20151022 - MBFWR (1),/*')
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
window.loadSaved = function(){
|
||||
a.data.loadJSON(require('fs').readFileSync('insta.json', 'utf-8'))
|
||||
|
||||
@ -233,6 +233,9 @@ module.GLOBAL_KEYBOARD = {
|
||||
alt: 'browseActions: "/Bookmark/"',
|
||||
},
|
||||
C: 'browseActions: "/Crop/"',
|
||||
|
||||
// XXX for debug...
|
||||
G: function(){ $('.viewer').toggleClass('visible-gid') },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -2901,12 +2901,15 @@ if(window.nodejs != null){
|
||||
var file = requirejs('./file')
|
||||
}
|
||||
|
||||
|
||||
var FileSystemLoaderActions = actions.Actions({
|
||||
// XXX
|
||||
loadPath: ['File/',
|
||||
function(path){
|
||||
var that = this
|
||||
|
||||
// XXX get a logger...
|
||||
|
||||
// XXX this will not work for explicit path (path to a dir
|
||||
// that contains the index)
|
||||
file.loadIndex(path)
|
||||
@ -2915,36 +2918,14 @@ var FileSystemLoaderActions = actions.Actions({
|
||||
|
||||
// XXX res may contain multiple indexes, need to
|
||||
// combine them...
|
||||
|
||||
var k = Object.keys(res)[0]
|
||||
var index = res[k]
|
||||
|
||||
// XXX use the logger...
|
||||
console.log('LOADING:', k)
|
||||
|
||||
var d = data.Data.fromJSON(res[k].data)
|
||||
// XXX need to load tags, marks, bookmarks, ...
|
||||
// XXX
|
||||
|
||||
// XXX need to make this segment specific...
|
||||
d.base = k
|
||||
|
||||
// XXX STUB remove ASAP...
|
||||
// ...need a real way to handle base dir, possible
|
||||
// approaches:
|
||||
// 1) .base attr in image, set on load and
|
||||
// do not save (or ignore on load)...
|
||||
// if exists prepend to all paths...
|
||||
// - more to do in view-time
|
||||
// + more flexible
|
||||
// 2) add/remove on load/save (approach below)
|
||||
// + less to do in real time
|
||||
// - more processing on load/save
|
||||
var img = images.Images(res[k].images)
|
||||
.forEach(function(_, img){ img.base = k })
|
||||
|
||||
that.load({
|
||||
data: d,
|
||||
images: img,
|
||||
})
|
||||
|
||||
that.load(file.buildIndex(index, k))
|
||||
})
|
||||
}],
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user