dynamic-virtual-scroller
Advanced tools
Comparing version
{ | ||
"name": "dynamic-virtual-scroller", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "A virtual scroller for the web that can handle dynamic row and column sizes.", | ||
@@ -5,0 +5,0 @@ "main": "virtual-scroller.js", |
@@ -16,3 +16,4 @@ import {ATTRIBUTES, EVENTS, CLASSES} from "./constants"; | ||
config = validateParameters(config, { | ||
loadRange: {type: 'function'} | ||
loadRange: {type: 'function'}, | ||
rangeSize: {type: 'number', default: 25} | ||
}); | ||
@@ -73,9 +74,13 @@ | ||
var nextRangeIsLoaded = !!getRangeForIndex({ranges: requestedRanges, index: params.index + 1}); | ||
/* | ||
If the next range is already loaded, we preload into the other "direction" instead. | ||
*/ | ||
range = Range({ | ||
start: params.index, | ||
end: params.index + 25 | ||
start: Math.max(nextRangeIsLoaded ? params.index - config.rangeSize : params.index, 0), | ||
end: nextRangeIsLoaded ? params.index : params.index + config.rangeSize | ||
}); | ||
requestedRanges = requestedRanges.concat(range); | ||
} | ||
@@ -82,0 +87,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
480980
0.38%6371
0.5%