alignDataToRibbon(...) working, needs more testing + identified a class of buggs (see TODO.otl)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-08-23 04:20:47 +04:00
parent 21ac274a19
commit d75741205a
2 changed files with 21 additions and 2 deletions

View File

@ -95,6 +95,8 @@ Roadmap
[_] 29% Gen 3 current todo
[_] 59% High priority
[_] BUG CLASS: everything should work with empty ribbons...
| currently some code breaks when seeing an empty ribbon...
[_] add indicator to ribbon up/down navigation in full screen...
| this might be a number or some kind of animation...
[_] BUG: sometimes opening a dir (open dialog) does not do anything...

View File

@ -590,9 +590,12 @@ function getImageGIDs(from, count, ribbon, inclusive){
}
})
}
// XXX check if this is empty...
ribbon = DATA.ribbons[ribbon]
// ribbon this is empty...
if(ribbon.length == 0){
return []
}
if(count > 0){
var c = inclusive == null ? 1 : 0
var start = ribbon.indexOf(from) + c
@ -850,7 +853,12 @@ function splitData(data, gid1){
// XXX revise...
for(var j=0; j<gids.length; j++){
var prev = cur
var cur = r.indexOf(getGIDBefore(gids[j], i, null, data)) + 1
var gid = getGIDBefore(gids[j], i, null, data)
if(gid == gids[j]){
var cur = r.indexOf(gid)
} else {
var cur = r.indexOf(gid) + 1
}
// split and save the section to the corresponding data object...
res[j].ribbons.push(r.slice(prev, cur))
@ -915,6 +923,15 @@ function alignDataToRibbon(ribbon, data){
var res = mergeData.apply(null, sections)
res.current = data.current
// clean out empty ribbons from head and tail...
while(res.ribbons[0].length == 0){
res.ribbons.splice(0, 1)
}
while(res.ribbons[res.ribbons.length-1].length == 0){
res.ribbons.pop()
}
return res
}