From 4ceaaf5ea1ab6d7565a4c5d3212a0d7875a401a4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 24 Jan 2015 14:18:33 -0800 Subject: [PATCH] Allow scrollbars to be dragged outside the window on supporting browsers Summary: In Safari, Firefox and Chrome drags outside the window will work if we do this. Safari didn't work before, not sure about the other two. Test Plan: Clicked the scroll handle, then dragged my mouse to the right (outside the window) and down. Page scrolled in Safari, Firefox, and Chrome. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11484 --- resources/celerity/map.php | 16 ++++++++-------- webroot/rsrc/externals/javelin/lib/Scrollbar.js | 6 +++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 0dce05bfcc..5e3976ecca 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -199,7 +199,7 @@ return array( 'rsrc/externals/javelin/lib/Resource.js' => '44959b73', 'rsrc/externals/javelin/lib/Routable.js' => 'b3e7d692', 'rsrc/externals/javelin/lib/Router.js' => '29274e2b', - 'rsrc/externals/javelin/lib/Scrollbar.js' => '65a65098', + 'rsrc/externals/javelin/lib/Scrollbar.js' => 'a89e4fc3', 'rsrc/externals/javelin/lib/URI.js' => '6eff08aa', 'rsrc/externals/javelin/lib/Vector.js' => 'cc1bd0b0', 'rsrc/externals/javelin/lib/WebSocket.js' => '3f840822', @@ -673,7 +673,7 @@ return array( 'javelin-resource' => '44959b73', 'javelin-routable' => 'b3e7d692', 'javelin-router' => '29274e2b', - 'javelin-scrollbar' => '65a65098', + 'javelin-scrollbar' => 'a89e4fc3', 'javelin-stratcom' => '8b0ad945', 'javelin-tokenizer' => '7644823e', 'javelin-typeahead' => '70baed2f', @@ -1244,12 +1244,6 @@ return array( 'javelin-dom', 'javelin-fx', ), - '65a65098' => array( - 'javelin-install', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-vector', - ), '6882e80a' => array( 'javelin-dom', ), @@ -1556,6 +1550,12 @@ return array( 'javelin-stratcom', 'javelin-dom', ), + 'a89e4fc3' => array( + 'javelin-install', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-vector', + ), 'a8d8459d' => array( 'javelin-behavior', 'javelin-dom', diff --git a/webroot/rsrc/externals/javelin/lib/Scrollbar.js b/webroot/rsrc/externals/javelin/lib/Scrollbar.js index b8e643b484..f80c65dd43 100644 --- a/webroot/rsrc/externals/javelin/lib/Scrollbar.js +++ b/webroot/rsrc/externals/javelin/lib/Scrollbar.js @@ -76,7 +76,11 @@ JX.install('Scrollbar', { JX.DOM.listen(this._bar, 'mousedown', null, JX.bind(this, this._onjump)); JX.enableDispatch(document.body, 'mouseenter'); - JX.enableDispatch(document.body, 'mousemove'); + + // Enabling dispatch for this event on `window` allows us to scroll even + // if the mouse cursor is dragged outside the window in at least some + // browsers (for example, Safari on OSX). + JX.enableDispatch(window, 'mousemove'); JX.DOM.listen(viewport, 'mouseenter', null, JX.bind(this, this._onenter)); JX.DOM.listen(frame, 'scroll', null, JX.bind(this, this._onscroll));