Working on sort
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
b7ff3ad1db
commit
4d9c3145fc
@ -341,7 +341,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var index, length = this.thumbnails.length;
|
||||
var index, length = this.thumbnails.length - 1;
|
||||
|
||||
This needs to become a binary sort between min/max set by either visibleThumbs, or the full
|
||||
array. 'index' adjustments then need to be done based on these values instead of on the full
|
||||
array or the search can end up bouncing over the 'visible' items
|
||||
|
||||
if (this.visibleThumbs.length) {
|
||||
index = this.visibleThumbs[this.visibleThumbs.length >> 1];
|
||||
@ -383,6 +387,10 @@
|
||||
visible.push(tmp++);
|
||||
}
|
||||
|
||||
visible.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
var i;
|
||||
/* Remove 'visible' attribute from any thumbnail
|
||||
* that was visible and is not in the new set of
|
||||
@ -390,12 +398,10 @@
|
||||
this.visibleThumbs.forEach(function(index) {
|
||||
for (i = 0; i < visible.length; i++) {
|
||||
if (visible[i] == index) {
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i == visible.length) {
|
||||
this.thumbnails[index].visible = false;
|
||||
}
|
||||
this.thumbnails[index].visible = false;
|
||||
}.bind(this));
|
||||
|
||||
/* Turn on visibility for any item that is now visible */
|
||||
|
Loading…
x
Reference in New Issue
Block a user