Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/79165


Change subject: Fixing inspector popup position
......................................................................

Fixing inspector popup position

The inspector popup should appear relative to the position of the related
calling method - either relative to the cursor (like in links and language)
or relative to the focusableNode (like in templates/transclusion).

Bug: 50905
Change-Id: I07f58d0c6561adecbec560fc24bcb6e590f2cd9f
---
M modules/ve/ui/ve.ui.Context.js
1 file changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/65/79165/1

diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 7a3577b..7334645 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -253,11 +253,20 @@
                position = surface.getSelectionRect(),
                surfaceOffset = surface.$.offset();
 
-       // translate from ce surface
-       position = {
-               y: position.end.y - surfaceOffset.top,
-               x: position.end.x - surfaceOffset.left
-       };
+       // If there's a focused node, fit the position to its corner:
+       if ( focusedNode !== null ) {
+               position = {
+                       x: focusedNode.$.position().left,
+                       y: focusedNode.$.position().top
+               };
+       } else {
+               // Otherwise, use the cursor position.
+               // translate from ce surface
+               position = {
+                       y: position.end.y - surfaceOffset.top,
+                       x: position.end.x - surfaceOffset.left
+               };
+       }
 
        if ( position ) {
                $container = inspector ? this.inspectors.$ : this.$menu;

-- 
To view, visit https://gerrit.wikimedia.org/r/79165
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07f58d0c6561adecbec560fc24bcb6e590f2cd9f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to