From 3816ff9438a73233bdea2512f51439306a1be156 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 13 Nov 2014 21:37:04 +0000 Subject: Smooth scroll; admit count prefixes. --- content_scripts/scroller.coffee | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index c69ca235..ed024724 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -88,7 +88,6 @@ checkVisibility = (element) -> doScrollBy = do -> # This is logical time. Time is advanced each time an animator is activated, and on each keyup event. time = 0 - mostRecentActivationTime = -1 lastEvent = null keyHandler = null @@ -108,14 +107,10 @@ doScrollBy = do -> checkVisibility element return - if mostRecentActivationTime == time or lastEvent?.repeat - # Either the most-recently activated animator has not yet received its keyup event (so it's still - # scrolling), or this is a keyboard repeat (for which we don't initiate a new animator). - # NOTE(smblott) We need both of these checks because sometimes (perhaps one time in twenty) the last - # keyboard repeat arrives *after* the corresponding keyup. - return + # We don't activate new animators on keyboard repeats. + return if lastEvent?.repeat - mostRecentActivationTime = activationTime = ++time + activationTime = ++time isKeyStillDown = -> time == activationTime -- cgit v1.2.3