dynamic-virtual-scroller
Advanced tools
Comparing version 3.0.4 to 3.0.5
{ | ||
"name": "dynamic-virtual-scroller", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "A virtual scroller for the web that can handle dynamic row and column sizes.", | ||
@@ -5,0 +5,0 @@ "main": "virtual-scroller.js", |
@@ -198,6 +198,25 @@ import {ATTRIBUTES, EVENTS, CLASSES, DATA} from "./constants"; | ||
*/ | ||
var lastScrollTop = 0; | ||
var lastScrollLeft = 0; | ||
var scrollManager = ScrollManager(config, renderManager); | ||
scrollManager.subscribe(_.throttle( | ||
// renderManager might have already been set to null in API.destroy | ||
(scrollLeft, scrollTop) => renderManager && renderManager.render(scrollManager), | ||
(scrollLeft, scrollTop) => { | ||
// renderManager might have already been set to null in API.destroy | ||
if (!renderManager) { | ||
return; | ||
} | ||
/* | ||
Optimization: Only render if the scroll delta is bigger than a row / column. | ||
We can only do this with native scrolling because in the other case | ||
renderManager.render() is responsible for the scrolling itself (using css translation). | ||
*/ | ||
if (config.useNativeScrolling && | ||
Math.abs(scrollTop - lastScrollTop) <= config.rowHeight && | ||
(!config.renderColumn || Math.abs(scrollLeft - lastScrollLeft) <= config.columnWidth)) { | ||
return; | ||
} | ||
lastScrollTop = scrollTop; | ||
lastScrollLeft = scrollLeft; | ||
renderManager.render(scrollManager) | ||
}, | ||
Math.round(1000 / config.fps), | ||
@@ -204,0 +223,0 @@ {leading: true, trailing: true} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
500604
6767