jenkins-bot has submitted this change and it was merged.
Change subject: Bind listener to keyup to capture arrows & better math for
scrolling.
......................................................................
Bind listener to keyup to capture arrows & better math for scrolling.
Listen to keyup to properly capture and respond to up and down arrows.
Rewrite calculation for scroll to better follow toolbar obscured cursor.
Bug: 48787
Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa
---
M modules/ve/ui/ve.ui.Toolbar.js
1 file changed, 6 insertions(+), 5 deletions(-)
Approvals:
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ui/ve.ui.Toolbar.js b/modules/ve/ui/ve.ui.Toolbar.js
index 194a59c..f122166 100644
--- a/modules/ve/ui/ve.ui.Toolbar.js
+++ b/modules/ve/ui/ve.ui.Toolbar.js
@@ -40,7 +40,7 @@
'scroll': ve.bind( this.onWindowScroll, this )
};
this.surfaceViewEvents = {
- 'keypress': ve.bind( this.onSurfaceViewKeyPress, this )
+ 'keyup': ve.bind( this.onSurfaceViewKeyUp, this )
};
// Events
@@ -125,14 +125,15 @@
};
/**
- * Method to scroll to the cursor position while toolbar is floating on
keypress only if
+ * Method to scroll to the cursor position while toolbar is floating on keyup
only if
* the cursor is obscured by the toolbar.
*
*/
-ve.ui.Toolbar.prototype.onSurfaceViewKeyPress = function () {
+ve.ui.Toolbar.prototype.onSurfaceViewKeyUp = function () {
var cursorPos = this.surface.view.getSelectionRect(),
- scrollTo = cursorPos.end.y - this.surface.view.$.offset().top,
- obscured = cursorPos.end.y - this.$window.scrollTop() <
this.$.height() + this.$.offset().top;
+ barHeight = this.$bar.height(),
+ scrollTo = this.$bar.offset().top - barHeight + (
cursorPos.end.y - cursorPos.start.y ),
+ obscured = cursorPos.start.y - this.$window.scrollTop() <
barHeight;
// If toolbar is floating and cursor is obscured, scroll cursor into
view
if ( obscured && this.floating ) {
--
To view, visit https://gerrit.wikimedia.org/r/73015
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits