jenkins-bot has submitted this change and it was merged.

Change subject: Fix image resize handles update on surface change
......................................................................


Fix image resize handles update on surface change

The resizing handles under ResizableNode are created in the location of the 
image
but if the page is edited and the image moves relative to the document, the 
handles
remained where the image was previously and not where its updated location is 
at.

This code fixes that bug by changing the CE event listening to the model's 
'transact'
instead of 'history', and clears the cached offset when a 'transact' event 
happens.

Change-Id: Id0e4296dd89b24839ba68a534ca77d73c23b7434
---
M modules/ve/ce/ve.ce.ResizableNode.js
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Catrope: Looks good to me, but someone else must approve
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/ce/ve.ce.ResizableNode.js 
b/modules/ve/ce/ve.ce.ResizableNode.js
index 3009cbc..94cba3b 100644
--- a/modules/ve/ce/ve.ce.ResizableNode.js
+++ b/modules/ve/ce/ve.ce.ResizableNode.js
@@ -184,9 +184,9 @@
        var surfaceModel = this.getRoot().getSurface().getModel();
 
        if ( this.live ) {
-               surfaceModel.connect( this, { 'history': 
'setResizableHandlesSizeAndPosition' } );
+               surfaceModel.getDocument().connect( this, { 'transact': 
'setResizableHandlesSizeAndPosition' } );
        } else {
-               surfaceModel.disconnect( this, { 'history': 
'setResizableHandlesSizeAndPosition' } );
+               surfaceModel.getDocument().disconnect( this, { 'transact': 
'setResizableHandlesSizeAndPosition' } );
                this.onResizableBlur();
        }
 };
@@ -265,6 +265,9 @@
        var width = this.$resizable.width(),
                height = this.$resizable.height();
 
+       // Clear cached resizable offset position as it may have changed
+       this.resizableOffset = null;
+
        this.setResizableHandlesPosition();
 
        this.$resizeHandles

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id0e4296dd89b24839ba68a534ca77d73c23b7434
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to