mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ce5e7350ab
commit
90ea24633a
@ -849,123 +849,7 @@ var DataPrototype = {
|
|||||||
// one of the contained images (first?)
|
// one of the contained images (first?)
|
||||||
// XXX for some reason negative target number (ribbon number)
|
// XXX for some reason negative target number (ribbon number)
|
||||||
// breaks this...
|
// breaks this...
|
||||||
/*
|
//
|
||||||
_getImages: function(target, count, mode){
|
|
||||||
target = (target == null && count == null) ? 'loaded' : target
|
|
||||||
mode = mode == null ? 'around' : mode
|
|
||||||
var list
|
|
||||||
|
|
||||||
// normalize target and build the source list...
|
|
||||||
|
|
||||||
// 'current' ribbon...
|
|
||||||
target = target == 'current' ? this.current : target
|
|
||||||
|
|
||||||
// get all gids...
|
|
||||||
if(target == 'all'){
|
|
||||||
list = this.order
|
|
||||||
target = null
|
|
||||||
|
|
||||||
// get loaded only gids...
|
|
||||||
} else if(target == 'loaded'){
|
|
||||||
var res = []
|
|
||||||
var ribbons = this.ribbons
|
|
||||||
for(var k in ribbons){
|
|
||||||
this.makeSparseImages(ribbons[k], res)
|
|
||||||
}
|
|
||||||
list = res.compact()
|
|
||||||
target = null
|
|
||||||
|
|
||||||
// filter out the unloaded gids from given list...
|
|
||||||
} else if(target != null && target.constructor === Array){
|
|
||||||
var loaded = count == 'current' ? this.getImages('current')
|
|
||||||
: count in this.ribbons ? this.ribbons[count].compact()
|
|
||||||
: typeof(count) == typeof(123) ?
|
|
||||||
this.ribbons[this.getRibbon(count)].compact()
|
|
||||||
: this.getImages('loaded')
|
|
||||||
count = null
|
|
||||||
|
|
||||||
list = target.filter(function(e){
|
|
||||||
return loaded.indexOf(e) >= 0
|
|
||||||
})
|
|
||||||
|
|
||||||
target = null
|
|
||||||
|
|
||||||
// target is ribbon gid...
|
|
||||||
} else if(target in this.ribbons){
|
|
||||||
list = this.ribbons[target]
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: list can be null if we got an image gid or ribbon order...
|
|
||||||
// get the ribbon gids...
|
|
||||||
if(list == null){
|
|
||||||
list = this.ribbons[this.getRibbon(target)]
|
|
||||||
// XXX compacting here is bad, we'll be handling the whole ribbon...
|
|
||||||
list = list != null ? list.compact() : []
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count == null){
|
|
||||||
return list.slice()
|
|
||||||
}
|
|
||||||
|
|
||||||
target = this.getImage(target)
|
|
||||||
var i = list.indexOf(target)
|
|
||||||
|
|
||||||
// prepare to slice the list...
|
|
||||||
if(mode == 'around'){
|
|
||||||
count = count/2
|
|
||||||
var from = i - Math.floor(count)
|
|
||||||
var to = i + Math.ceil(count)
|
|
||||||
|
|
||||||
var pre = Math.floor(count)
|
|
||||||
var post = Math.ceil(count)
|
|
||||||
|
|
||||||
} else if(mode == 'before'){
|
|
||||||
// NOTE: we are shifting by 1 to include the target...
|
|
||||||
var from = (i - count) + 1
|
|
||||||
var to = i + 1
|
|
||||||
|
|
||||||
var pre = count - 1
|
|
||||||
var post = 0
|
|
||||||
|
|
||||||
} else if(mode == 'after'){
|
|
||||||
var from = i
|
|
||||||
var to = i + count
|
|
||||||
|
|
||||||
var pre = 0
|
|
||||||
var post = count - 1
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// XXX bad mode....
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the actual bounds...
|
|
||||||
from = Math.max(0, from)
|
|
||||||
|
|
||||||
return list.slice(from, to)
|
|
||||||
|
|
||||||
|
|
||||||
var res = [target]
|
|
||||||
|
|
||||||
// pre...
|
|
||||||
for(var n = i-1; n >= 0 && pre > 0; n--){
|
|
||||||
if(n in list){
|
|
||||||
res.push(list[n])
|
|
||||||
pre--
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res.reverse()
|
|
||||||
// post...
|
|
||||||
for(var n = i+1; n < list.length && post > 0; n--){
|
|
||||||
if(n in list){
|
|
||||||
res.push(list[n])
|
|
||||||
post--
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
// NOTE: this is a partial rewrite avoiding .compact() as much as
|
// NOTE: this is a partial rewrite avoiding .compact() as much as
|
||||||
// possible and restricting it to as small a subset as possible
|
// possible and restricting it to as small a subset as possible
|
||||||
getImages: function(target, count, mode){
|
getImages: function(target, count, mode){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user