mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Fix window-exiting drags and drag-and-hold behaviors in JX.Scrollbar
Summary: Fixes two issues: - In Firefox, dragging outside the window and releasing the mouse button would miss the `mouseup` event. This would leave the bar dragging, even though the user had released the mouse button. - In all browsers, dragging the handle and then holding your cursor in one place for more than a second would hide the handle. Instead, never hide the handle during a drag. Test Plan: - In Firefox, dragged handle right (outside of window) and released mouse button. Waved cursor over window; no more "sticky" scroll. - In FF/Chrome/Safari, dragged handle and held cursor in same position for several seconds. No more handle hide. - Waved cursor over window and made sure normal hiding still works. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11487
This commit is contained in:
parent
6288d8a7d4
commit
e0289070db
3 changed files with 27 additions and 14 deletions
|
@ -166,7 +166,7 @@ return array(
|
|||
'rsrc/externals/javelin/core/__tests__/install.js' => 'c432ee85',
|
||||
'rsrc/externals/javelin/core/__tests__/stratcom.js' => '88bf7313',
|
||||
'rsrc/externals/javelin/core/__tests__/util.js' => 'e251703d',
|
||||
'rsrc/externals/javelin/core/init.js' => '8c4e8f8b',
|
||||
'rsrc/externals/javelin/core/init.js' => '4df97779',
|
||||
'rsrc/externals/javelin/core/init_node.js' => 'c234aded',
|
||||
'rsrc/externals/javelin/core/install.js' => '05270951',
|
||||
'rsrc/externals/javelin/core/util.js' => '93cc50d6',
|
||||
|
@ -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' => '8ebeb833',
|
||||
'rsrc/externals/javelin/lib/Scrollbar.js' => 'ad2c4a94',
|
||||
'rsrc/externals/javelin/lib/URI.js' => '6eff08aa',
|
||||
'rsrc/externals/javelin/lib/Vector.js' => 'cc1bd0b0',
|
||||
'rsrc/externals/javelin/lib/WebSocket.js' => '3f840822',
|
||||
|
@ -663,7 +663,7 @@ return array(
|
|||
'javelin-install' => '05270951',
|
||||
'javelin-json' => '69adf288',
|
||||
'javelin-leader' => '331b1611',
|
||||
'javelin-magical-init' => '8c4e8f8b',
|
||||
'javelin-magical-init' => '4df97779',
|
||||
'javelin-mask' => '8a41885b',
|
||||
'javelin-reactor' => '2b8de964',
|
||||
'javelin-reactor-dom' => 'c90a04fc',
|
||||
|
@ -673,7 +673,7 @@ return array(
|
|||
'javelin-resource' => '44959b73',
|
||||
'javelin-routable' => 'b3e7d692',
|
||||
'javelin-router' => '29274e2b',
|
||||
'javelin-scrollbar' => '8ebeb833',
|
||||
'javelin-scrollbar' => 'ad2c4a94',
|
||||
'javelin-stratcom' => '8b0ad945',
|
||||
'javelin-tokenizer' => '7644823e',
|
||||
'javelin-typeahead' => '70baed2f',
|
||||
|
@ -1468,12 +1468,6 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-behavior',
|
||||
),
|
||||
'8ebeb833' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'8ef9ab58' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
@ -1582,6 +1576,12 @@ return array(
|
|||
'javelin-util',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'ad2c4a94' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'ad7a69ca' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
|
12
webroot/rsrc/externals/javelin/core/init.js
vendored
12
webroot/rsrc/externals/javelin/core/init.js
vendored
|
@ -132,7 +132,6 @@
|
|||
'mousedown',
|
||||
'mouseover',
|
||||
'mouseout',
|
||||
'mouseup',
|
||||
'keyup',
|
||||
'keydown',
|
||||
'input',
|
||||
|
@ -172,8 +171,8 @@
|
|||
JX.enableDispatch(root, document_events[ii]);
|
||||
}
|
||||
|
||||
// In particular, we're interested in capturing window focus/blur here so
|
||||
// long polls can abort when the window is not focused.
|
||||
// In particular, we're interested in capturing window focus/blur here so
|
||||
// long polls can abort when the window is not focused.
|
||||
var window_events = [
|
||||
('onpagehide' in window) ? 'pagehide' : 'unload',
|
||||
'resize',
|
||||
|
@ -181,7 +180,12 @@
|
|||
'focus',
|
||||
'blur',
|
||||
'popstate',
|
||||
'hashchange'
|
||||
'hashchange',
|
||||
|
||||
// In Firefox, if the user clicks in the window then drags the cursor
|
||||
// outside of the window and releases the mouse button, we don't get this
|
||||
// event unless we listen for it as a window event.
|
||||
'mouseup'
|
||||
];
|
||||
|
||||
if (window.localStorage) {
|
||||
|
|
|
@ -238,6 +238,9 @@ JX.install('Scrollbar', {
|
|||
*/
|
||||
_ondrop: function() {
|
||||
this._dragOrigin = null;
|
||||
|
||||
// Reset the timer to hide the bar.
|
||||
this._showBar();
|
||||
},
|
||||
|
||||
|
||||
|
@ -293,6 +296,12 @@ JX.install('Scrollbar', {
|
|||
* Hide the scrollbar.
|
||||
*/
|
||||
_hideBar: function() {
|
||||
if (this._dragOrigin !== null) {
|
||||
// If we're currently dragging the handle, we never want to hide
|
||||
// it.
|
||||
return;
|
||||
}
|
||||
|
||||
JX.DOM.alterClass(this._handle, 'jx-scrollbar-visible', false);
|
||||
this._clearTimeout();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue