mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Fix an issue with dragging the scrollbar handle from a noninitial position
Summary: See <rPc40bc0c8bf75#4050>. Repro steps: - Scroll partway down the page. - Click and drag the scroll handle. Prior to this diff, the handle incorrectly jumps back to the top of the page. This is because we didn't store the handle's original position. (In testing, I always dragged from near the top of the page, and I don't normally drag scrollbars, so I didn't notice this.) Test Plan: Clicking and dragging a partially scrolled handle now works correctly. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11483
This commit is contained in:
parent
04ab81aa76
commit
25fc168c95
2 changed files with 16 additions and 10 deletions
|
@ -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' => 'e8e4c640',
|
||||
'rsrc/externals/javelin/lib/Scrollbar.js' => '65a65098',
|
||||
'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' => 'e8e4c640',
|
||||
'javelin-scrollbar' => '65a65098',
|
||||
'javelin-stratcom' => '8b0ad945',
|
||||
'javelin-tokenizer' => '7644823e',
|
||||
'javelin-typeahead' => '70baed2f',
|
||||
|
@ -1244,6 +1244,12 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-fx',
|
||||
),
|
||||
'65a65098' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'6882e80a' => array(
|
||||
'javelin-dom',
|
||||
),
|
||||
|
@ -1845,12 +1851,6 @@ return array(
|
|||
'javelin-behavior-device',
|
||||
'phabricator-keyboard-shortcut',
|
||||
),
|
||||
'e8e4c640' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'e9581f08' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
|
10
webroot/rsrc/externals/javelin/lib/Scrollbar.js
vendored
10
webroot/rsrc/externals/javelin/lib/Scrollbar.js
vendored
|
@ -127,6 +127,7 @@ JX.install('Scrollbar', {
|
|||
|
||||
_timeout: null,
|
||||
_dragOrigin: null,
|
||||
_scrollOrigin: null,
|
||||
|
||||
|
||||
/**
|
||||
|
@ -181,7 +182,12 @@ JX.install('Scrollbar', {
|
|||
*/
|
||||
_ondrag: function(e) {
|
||||
e.kill();
|
||||
|
||||
// Store the position where the drag started.
|
||||
this._dragOrigin = JX.$V(e).y;
|
||||
|
||||
// Store the original position of the handle.
|
||||
this._scrollOrigin = this._viewport.scrollTop;
|
||||
},
|
||||
|
||||
|
||||
|
@ -195,9 +201,9 @@ JX.install('Scrollbar', {
|
|||
|
||||
var offset = (JX.$V(e).y - this._dragOrigin);
|
||||
var ratio = offset / JX.Vector.getDim(this._bar).y;
|
||||
var target = ratio * JX.Vector.getDim(this._content).y;
|
||||
var adjust = ratio * JX.Vector.getDim(this._content).y;
|
||||
|
||||
this._viewport.scrollTop = target;
|
||||
this._viewport.scrollTop = this._scrollOrigin + adjust;
|
||||
},
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue