From 1efa327121ed22d77f766f84b2a7162e6d7234d7 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 22 Oct 2013 21:01:17 +0100 Subject: [PATCH] Recalculate $resizable offset when positioning resize label Because it can change. Currently the resize label is not positioned correctly if you use three of four resize handles. Change-Id: I1a28bc57fda1097c94047fd7690ad8d403cdd478 --- modules/ve/ce/ve.ce.ResizableNode.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/ve/ce/ve.ce.ResizableNode.js b/modules/ve/ce/ve.ce.ResizableNode.js index 4878a2c18a..f9a58b50ca 100644 --- a/modules/ve/ce/ve.ce.ResizableNode.js +++ b/modules/ve/ce/ve.ce.ResizableNode.js @@ -82,21 +82,24 @@ ve.ce.ResizableNode.prototype.updateSizeLabel = function ( dimensions ) { if ( !this.$sizeLabel ) { return; } - var node, top, height; + var offset, node, top, height; if ( dimensions ) { + offset = ve.Element.getRelativePosition( + this.$resizable, this.getRoot().getSurface().getSurface().$ + ); // Things get a bit tight below 100px, so put the label on the outside if ( dimensions.width < 100 ) { - top = dimensions.top + dimensions.height; + top = offset.top + dimensions.height; height = 30; } else { - top = dimensions.top; + top = offset.top; height = dimensions.height; } this.$sizeLabel .addClass( 've-ce-resizableNode-sizeLabel-resizing' ) .css( { 'top': top, - 'left': dimensions.left, + 'left': offset.left, 'width': dimensions.width, 'height': height, 'lineHeight': height + 'px'