1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-28 12:12:28 +01:00

Quick fix for smooth scroll.

Fixes issue #1048.
This commit is contained in:
Doug Kearns
2013-09-28 23:21:55 +10:00
parent fae3df30c0
commit b473571f81

View File

@@ -1531,7 +1531,8 @@ var Buffer = Module("Buffer", {
* Like scrollTo, but scrolls more smoothly and does not update
* marks.
*/
smoothScrollTo: function smoothScrollTo(node, x, y) {
smoothScrollTo: let (timers = WeakMap())
function smoothScrollTo(node, x, y) {
let { options } = overlay.activeModules;
let time = options["scrolltime"];
@@ -1539,8 +1540,8 @@ var Buffer = Module("Buffer", {
let elem = Buffer.Scrollable(node);
if (node.dactylScrollTimer)
node.dactylScrollTimer.cancel();
if (timers.has(node))
timers.get(node).cancel();
if (x == null)
x = elem.scrollLeft;
@@ -1561,7 +1562,7 @@ var Buffer = Module("Buffer", {
else {
elem.scrollLeft = startX + (x - startX) / steps * n;
elem.scrollTop = startY + (y - startY) / steps * n;
node.dactylScrollTimer = util.timeout(next, time / steps);
timers.set(node, util.timeout(next, time / steps));
}
}).call(this);
},