fixed another bug with rolling images...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-11-25 04:12:40 +04:00
parent 1f572cca9f
commit 675469caa7
3 changed files with 85 additions and 70 deletions

View File

@ -108,8 +108,39 @@ Roadmap
[_] 30% Gen 3 current todo [_] 29% Gen 3 current todo
[_] 60% High priority [_] 59% High priority
[_] 30% mark-based operations
[_] 50% cropping selection
[X] marked
[X] ribbon
[_] by tag/collection
[_] by group
[X] shift up/down
[_] tag
[_] group
| a group should behave as a single image but is
| viewable/expandable as a ribbon...
|
| should be two types of groups:
| - strict - always as a single image
| like a set of versions, processed and processing
| versions of the same image.
| (auto-group?)
| - loose - similar images, could be named collections
| viewed individually, but can be accessed either from
| a list or a member image (primary).
[_] collection
| make or add to existing collection
[_] 0% grouping / meta-image
[_] versions w. label image
| a set of images that is represented by one of the group
[_] collection
[_] editable list of external commands...
| to add things like exportdirs.py etc.
[_] Export data...
| same as export dirs but also include .ImageGrid/ dir with current
| data and images...
[_] OSX: add alternatives to function buttons... [_] OSX: add alternatives to function buttons...
[_] BUG: OSX: unable to load absolute paths... [_] BUG: OSX: unable to load absolute paths...
[_] BUG: when loading a non-existing dir, opening a new dir raises an error [_] BUG: when loading a non-existing dir, opening a new dir raises an error
@ -184,7 +215,7 @@ Roadmap
| - title | - title
| - directory taggs and meta info | - directory taggs and meta info
| - ... | - ...
[_] 33% mormalize ribbons -- top-align sorted chunks [_] 33% normalize ribbons -- top-align sorted chunks
[X] basic mechanics [X] basic mechanics
| splitData(...) | splitData(...)
| mergeData(...) | mergeData(...)
@ -222,11 +253,18 @@ Roadmap
| - CouchDB | - CouchDB
| - SQL | - SQL
| - file-db | - file-db
[_] add ability to save/load ranges of images and the structures around them
| e.g.load image 100 to current ribbon -> will load 100 images
| for current ribbon and all the in between images from other
| ribbons above and below...
[_] BUG CLASS: everything should work with empty ribbons... [_] BUG CLASS: everything should work with empty ribbons...
| currently some code breaks when seeing an empty ribbon... | currently some code breaks when seeing an empty ribbon...
[_] BUG: shifting last image out of a ribbon misaligns the current ribbon [_] BUG: shifting last image out of a ribbon misaligns the current ribbon
| i.e. the prev ribbon was deleted and the new focused ribbon | i.e. the prev ribbon was deleted and the new focused ribbon
| is aligned as if it was not current... | is aligned as if it was not current...
|
| this is due to a race condition -- the alignment is done BEFORE
| the current image is set...
[_] BUG: sometimes loading a raw directory stops at "error loading data.json" [_] BUG: sometimes loading a raw directory stops at "error loading data.json"
| and some times it does not err.. | and some times it does not err..
| |
@ -245,14 +283,12 @@ Roadmap
[_] index and group ALL files in an archive [_] index and group ALL files in an archive
[_] import metadata [_] import metadata
[_] real GIDs [_] real GIDs
[_] 33% Thumbnail generation strategies [_] 33% FAST thumbnail generation strategies
[_] 0% pass 1: generate really fast previews [_] 0% pass 1: generate really fast previews
[_] ~1/3 screen - for ribbon [_] ~1/3 screen - for ribbon
[_] ~1 screen - for single image mode [_] ~1 screen - for single image mode
[X] pass 2: generate normal previews [X] pass 2: generate normal previews
[_] extract existing raw thumbnails/previews (for RAW files) [_] extract existing raw thumbnails/previews (for RAW files)
[_] editable list of external commands...
| to add things like exportdirs.py etc.
[_] 0% Tablet UI [_] 0% Tablet UI
[_] screen buttons [_] screen buttons
[_] save settings to config.json [_] save settings to config.json
@ -311,38 +347,8 @@ Roadmap
[_] 50% Undo/Redo [_] 50% Undo/Redo
[X] basic one step (revert to last save) [X] basic one step (revert to last save)
[_] push/pop state stack [_] push/pop state stack
[_] 30% mark-based operations
[_] 50% cropping selection
[X] marked
[X] ribbon
[_] by tag/collection
[_] by group
[X] shift up/down
[_] tag
[_] group
| a group should behave as a single image but is
| viewable/expandable as a ribbon...
|
| should be two types of groups:
| - strict - always as a single image
| like a set of versions, processed and processing
| versions of the same image.
| (auto-group?)
| - loose - similar images, could be named collections
| viewed individually, but can be accessed either from
| a list or a member image (primary).
[_] collection
| make or add to existing collection
[_] check if preview loaded, else load a different preview... [_] check if preview loaded, else load a different preview...
[_] add ability to save/load ranges of images and the structures around them
| e.g.load image 100 to current ribbon -> will load 100 images
| for current ribbon and all the in between images from other
| ribbons above and below...
[_] single image mode transition (alpha-blend/fade/none) [_] single image mode transition (alpha-blend/fade/none)
[_] 0% grouping / meta-image
[_] versions w. label image
| a set of images that is represented by one of the group
[_] collection
[_] 0% CSS [_] 0% CSS
[_] cleanup [_] cleanup
[_] split themes and layout [_] split themes and layout
@ -686,7 +692,7 @@ Roadmap
[_] 61% Gen 3 UI implementation [_] 74% Gen 3 UI implementation
[X] 100% Infinite ribbon (lib) [X] 100% Infinite ribbon (lib)
[X] cyclic ribbon [X] cyclic ribbon
[X] image block generation [X] image block generation
@ -699,10 +705,10 @@ Roadmap
| save only a block or changed data... | save only a block or changed data...
[X] Adaptive preview size (lib) [X] Adaptive preview size (lib)
[X] Multiple ribbon (reuse) [X] Multiple ribbon (reuse)
[_] 0% User actions [_] 44% User actions
| see [[controls.otl]] for basic actions... | see [[controls.otl]] for basic actions...
| |
| additional actions: | additional actions:
[X] 100% toggle mark image [X] 100% toggle mark image
[X] mark between [X] mark between
| mark all images between closest marks | mark all images between closest marks
@ -725,11 +731,11 @@ Roadmap
[_] add/edit tags (set of images) [_] add/edit tags (set of images)
[_] add/edit tags (single image) [_] add/edit tags (single image)
[X] rotate image [X] rotate image
[_] 88% UI modes [X] 100% UI modes
[_] 66% single ribbon [X] 100% single ribbon
[X] show marked only [X] show marked only
[X] show current ribbon [X] show current ribbon
[_] show images shifted (all / above only / below only) in current ribbon [X] show images shifted (all / above only / below only) in current ribbon
[X] 100% multiple ribbons [X] 100% multiple ribbons
[X] show images above/below [X] show images above/below
[X] show marked only [X] show marked only

View File

@ -1423,6 +1423,7 @@ function loadImagesAround(count, gid, ribbon, data){
// XXX NOTE: we use || instead of && here to compensate for an oddity // XXX NOTE: we use || instead of && here to compensate for an oddity
// in getCommonSubArrayOffsets(...), see it for further details... // in getCommonSubArrayOffsets(...), see it for further details...
if(left == null || right == null){ if(left == null || right == null){
console.log('>>> Ribbon ', ribbon, 'reloading...')
var n = new_ribbon.indexOf(gid) var n = new_ribbon.indexOf(gid)
var o = old_ribbon.indexOf(gid) var o = old_ribbon.indexOf(gid)
o = o < 0 ? n : o o = o < 0 ? n : o
@ -1442,6 +1443,9 @@ function loadImagesAround(count, gid, ribbon, data){
// partial reload... // partial reload...
} else { } else {
console.log('>>> Ribbon ', ribbon, 'updating...')
console.log(' left:', left,
'right:', right)
var res = extendRibbon(left, right, ribbon_elem) var res = extendRibbon(left, right, ribbon_elem)
// XXX this will get all the current images, not the resulting ones... // XXX this will get all the current images, not the resulting ones...
var images = ribbon_elem.find('.image') var images = ribbon_elem.find('.image')
@ -1593,12 +1597,16 @@ function rollImages(n, ribbon, extend, no_compensate_shift){
if(n == 0){ if(n == 0){
return $([]) return $([])
} }
ribbon = ribbon == null ? getRibbon() : $(ribbon) var r = typeof(ribbon) == typeof(123) ? ribbon : null
ribbon = ribbon == null ? getRibbon()
: r != null ? getRibbon(ribbon)
: $(ribbon)
var r = r == null ? getRibbonIndex(ribbon) : r
var images = ribbon.find('.image') var images = ribbon.find('.image')
var from = n > 0 ? getImageGID(ribbon.find('.image').last()) var from = n > 0 ? getImageGID(ribbon.find('.image').last())
: getImageGID(ribbon.find('.image').first()) : getImageGID(ribbon.find('.image').first())
var gids = getImageGIDs(from, n) var gids = getImageGIDs(from, n, r)
if(gids.length == 0){ if(gids.length == 0){
return $([]) return $([])
} }

View File

@ -101,34 +101,35 @@ function setupDataBindings(viewer){
&& l < Math.round(screen_size * LOAD_SCREENS))){ && l < Math.round(screen_size * LOAD_SCREENS))){
//loadImages(gid, Math.round(screen_size * LOAD_SCREENS), ribbon) //loadImages(gid, Math.round(screen_size * LOAD_SCREENS), ribbon)
loadImagesAround(Math.round(screen_size * LOAD_SCREENS), gid, ribbon) loadImagesAround(Math.round(screen_size * LOAD_SCREENS), gid, ribbon)
}
// roll the ribbon while we are advancing... // roll the ribbon while we are advancing...
var head = img_before.prevAll('.image') } else {
var tail = img_before.nextAll('.image') var head = img_before.prevAll('.image')
var tail = img_before.nextAll('.image')
// NOTE: if this is greater than the number of images currently // NOTE: if this is greater than the number of images currently
// loaded, it might lead to odd effects... // loaded, it might lead to odd effects...
var frame_size = Math.ceil((screen_size * LOAD_SCREENS) / 2) var frame_size = Math.ceil((screen_size * LOAD_SCREENS) / 2)
var threshold = Math.floor(frame_size / 2) var threshold = Math.floor(frame_size / 2)
threshold = threshold < 1 ? 1 : threshold threshold = threshold < 1 ? 1 : threshold
// do the loading... // do the loading...
// XXX need to expand/contract the ribbon depending on speed... // XXX need to expand/contract the ribbon depending on speed...
// ...might also be a good idea to load smaller images // ...might also be a good idea to load smaller images
// while scrolling really fast... // while scrolling really fast...
// XXX use extendRibbon, to both roll and expand/contract... // XXX use extendRibbon, to both roll and expand/contract...
// XXX BUG: when rolling a ribbon, this will sometimes // XXX BUG: when rolling a ribbon, this will sometimes
// misalign an image... // misalign an image...
// ...where exactly this happens in the ribbon depends on // ...where exactly this happens in the ribbon depends on
// its size and LOAD_SCREENS... // its size and LOAD_SCREENS...
// NOTE: calling centerView() will fix this. // NOTE: calling centerView() will fix this.
// ...the problem is in centerRibbon // ...the problem is in centerRibbon
if(tail.length < threshold){ if(tail.length < threshold){
var rolled = rollImages(frame_size, ribbon) var rolled = rollImages(frame_size, ribbon)
} }
if(head.length < threshold){ if(head.length < threshold){
var rolled = rollImages(-frame_size, ribbon) var rolled = rollImages(-frame_size, ribbon)
}
} }
}) })