mirror of
https://github.com/flynx/ImageGrid.git
synced 2026-01-10 20:27:44 +00:00
alignDataToRibbon(...) done, needs testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
55fe0bb6b0
commit
21ac274a19
27
ui/data.js
27
ui/data.js
@ -807,6 +807,8 @@ function mergeData(a, b){
|
|||||||
// NOTE: this is the opposite of mergeData():
|
// NOTE: this is the opposite of mergeData():
|
||||||
// mergeData(splitData(data, ...)) == data
|
// mergeData(splitData(data, ...)) == data
|
||||||
// with the exception of .current
|
// with the exception of .current
|
||||||
|
// NOTE: this will ALWAYS return n+1 sections for n gids, even though
|
||||||
|
// some of them may be empty...
|
||||||
//
|
//
|
||||||
// XXX this is a bit brain-dead at the moment...
|
// XXX this is a bit brain-dead at the moment...
|
||||||
// XXX do we need to check if supplied gids exist in data???
|
// XXX do we need to check if supplied gids exist in data???
|
||||||
@ -891,8 +893,29 @@ function splitData(data, gid1){
|
|||||||
// |oooooooooooooooooooooooo|
|
// |oooooooooooooooooooooooo|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
function alignDataToRibbon(ribbon){
|
// NOTE: this will return a new data object.
|
||||||
// XXX
|
//
|
||||||
|
function alignDataToRibbon(ribbon, data){
|
||||||
|
data = data == null ? DATA : data
|
||||||
|
|
||||||
|
// get the ribbon above...
|
||||||
|
var r = data.ribbons[ribbon-1]
|
||||||
|
|
||||||
|
var start = r[0]
|
||||||
|
var end = r[r.length-1]
|
||||||
|
// NOTE: this can be null/undefined if we are looking at the last
|
||||||
|
// element...
|
||||||
|
end = data.order[data.order.indexOf(end)+1]
|
||||||
|
|
||||||
|
// NOTE: will this always return 3 sections (see docs)...
|
||||||
|
var sections = splitData(data, start, end)
|
||||||
|
|
||||||
|
// prepare to align...
|
||||||
|
sections[1] = [ ribbon, sections[1] ]
|
||||||
|
|
||||||
|
var res = mergeData.apply(null, sections)
|
||||||
|
res.current = data.current
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user