projects
/
bookreader.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7e7f557
)
Optimize preloading of thumbnail image rows, loading visible rows immediately
author
scollett
<stephanie.collett@ucop.edu>
Mon, 21 Dec 2009 19:09:06 +0000
(11:09 -0800)
committer
scollett
<stephanie.collett@ucop.edu>
Mon, 21 Dec 2009 19:09:06 +0000
(11:09 -0800)
BookReader/BookReader.js
patch
|
blob
|
history
diff --git
a/BookReader/BookReader.js
b/BookReader/BookReader.js
index
7995128
..
b24d57e
100644
(file)
--- a/
BookReader/BookReader.js
+++ b/
BookReader/BookReader.js
@@
-41,7
+41,7
@@
function BookReader() {
this.mode = 1; //1, 2, 3
this.ui = 'full'; // UI mode
this.thumbWidth = 100;
this.mode = 1; //1, 2, 3
this.ui = 'full'; // UI mode
this.thumbWidth = 100;
- this.thumbRowBuffer =
4
; // number of rows to pre-cache out a view
+ this.thumbRowBuffer =
3
; // number of rows to pre-cache out a view
this.displayedIndices = [];
this.displayedRows=[];
this.displayedIndices = [];
this.displayedRows=[];
@@
-632,12
+632,15
@@
BookReader.prototype.drawLeafsThumbnail = function() {
leafTop = leafBottom;
}
leafTop = leafBottom;
}
+ // create a buffer of preloaded rows before and after the visible rows
var firstRow = rowsToDisplay[0];
var lastRow = rowsToDisplay[rowsToDisplay.length-1];
for (i=1; i<this.thumbRowBuffer+1; i++) {
var firstRow = rowsToDisplay[0];
var lastRow = rowsToDisplay[rowsToDisplay.length-1];
for (i=1; i<this.thumbRowBuffer+1; i++) {
- if (firstRow-i >= 0) { rowsToDisplay.unshift(firstRow-i); }
if (lastRow+i < leafMap.length) { rowsToDisplay.push(lastRow+i); }
if (lastRow+i < leafMap.length) { rowsToDisplay.push(lastRow+i); }
-}
+ }
+ for (i=1; i<this.thumbRowBuffer+1; i++) {
+ if (firstRow-i >= 0) { rowsToDisplay.push(firstRow-i); }
+ }
// Update hash, but only if we're currently displaying a leaf
// Hack that fixes #365790
// Update hash, but only if we're currently displaying a leaf
// Hack that fixes #365790