From 84bca6fb893f41c1c179b71c1c894bdd81b64127 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 16 Dec 2014 08:25:42 +0000 Subject: Fix smooth scrolling, all cases. --- content_scripts/scroller.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index d3716a46..a2617289 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -34,13 +34,12 @@ getDimension = (el, direction, amount) -> else amount -# Perform a scroll. Return true if we successfully scrolled by the requested amount, and false otherwise. +# Perform a scroll. Return true if we successfully scrolled by any amount, and false otherwise. performScroll = (element, direction, amount) -> axisName = scrollProperties[direction].axisName before = element[axisName] element[axisName] += amount - scrollChange = element[axisName] - before - Math.abs(scrollChange - amount) <= 4 # At 25% zoom the scroll can be off by as much as 4. + element[axisName] != before # Test whether `element` should be scrolled. E.g. hidden elements should not be scrolled. shouldScroll = (element, direction) -> -- cgit v1.2.3