jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/336844 )
Change subject: ve.ui.Surface: fix issues with scrolling while selection
......................................................................
ve.ui.Surface: fix issues with scrolling while selection
Rely on browser-default behavior while dragging is occurring, as the start/end
of the selection isn't reliable.
Don't hugely jump when going off the bottom of the screen; behave like default
textarea does, and go down just enough to have the cursor in view.
Bug: T157291
Change-Id: I3a962a967d16851f2c2a55be4c3825f0db35aa46
---
M src/ui/ve.ui.Surface.js
1 file changed, 13 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/src/ui/ve.ui.Surface.js b/src/ui/ve.ui.Surface.js
index d7738aa..750acf0 100644
--- a/src/ui/ve.ui.Surface.js
+++ b/src/ui/ve.ui.Surface.js
@@ -499,6 +499,15 @@
return;
}
+ if ( this.getView().dragging ) {
+ // Allow native scroll behavior while dragging, as the start/end
+ // points are unreliable until we're finished. Without this,
trying to
+ // drag a selection larger than a single screen will sometimes
lock
+ // the viewport in place, as it tries to keep the wrong end of
the
+ // selection on-screen.
+ return;
+ }
+
// We only care about the focus end of the selection, the anchor never
// moves and should be allowed off screen. Thus, we get the start/end
// rects, and calculate based on the end.
@@ -521,9 +530,12 @@
cursorTop = clientRect.top - 5;
cursorBottom = clientRect.bottom + 5;
- if ( cursorTop < topBound || cursorBottom > bottomBound ) {
+ if ( cursorTop < topBound ) {
scrollTo = this.$scrollContainer.scrollTop() + ( cursorTop -
topBound );
this.scrollTo( scrollTo );
+ } else if ( cursorBottom > bottomBound ) {
+ scrollTo = this.$scrollContainer.scrollTop() + ( cursorBottom -
bottomBound );
+ this.scrollTo( scrollTo );
}
};
--
To view, visit https://gerrit.wikimedia.org/r/336844
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3a962a967d16851f2c2a55be4c3825f0db35aa46
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
Gerrit-Reviewer: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits