From 600110b9c5f748f4b1cac484bcebcd882fc9323e Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 14 Oct 2013 12:04:59 +0100 Subject: [PATCH] Split out setResizableHandlesPosition in ResizableNode Change-Id: I254fc1851abdc7477e2067d1a6b5406f286e8668 --- modules/ve/ce/ve.ce.ResizableNode.js | 35 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/modules/ve/ce/ve.ce.ResizableNode.js b/modules/ve/ce/ve.ce.ResizableNode.js index f33bf93b2b..33397300b6 100644 --- a/modules/ve/ce/ve.ce.ResizableNode.js +++ b/modules/ve/ce/ve.ce.ResizableNode.js @@ -170,30 +170,45 @@ ve.ce.ResizableNode.prototype.onResizeHandlesCornerMouseDown = function ( e ) { * @method */ ve.ce.ResizableNode.prototype.setResizableHandlesSizeAndPosition = function () { - var offset = ve.Element.getRelativePosition( - this.$resizable, this.getRoot().getSurface().getSurface().$ - ); + var width = this.$resizable.width(), + height = this.$resizable.height(); + + this.setResizableHandlesPosition(); this.$resizeHandles .css( { 'width': 0, - 'height': 0, - 'top': offset.top, - 'left': offset.left + 'height': 0 } ) .find( '.ve-ce-resizableNode-neHandle' ) - .css( { 'margin-right': -this.$resizable.width() } ) + .css( { 'margin-right': -width } ) .end() .find( '.ve-ce-resizableNode-swHandle' ) - .css( { 'margin-bottom': -this.$resizable.height() } ) + .css( { 'margin-bottom': -height } ) .end() .find( '.ve-ce-resizableNode-seHandle' ) .css( { - 'margin-right': -this.$resizable.width(), - 'margin-bottom': -this.$resizable.height() + 'margin-right': -width, + 'margin-bottom': -height } ); }; +/** + * Set the proper position for resize handles + * + * @method + */ +ve.ce.ResizableNode.prototype.setResizableHandlesPosition = function () { + var offset = ve.Element.getRelativePosition( + this.$resizable, this.getRoot().getSurface().getSurface().$ + ); + + this.$resizeHandles.css( { + 'top': offset.top, + 'left': offset.left + } ); +}; + /** * Handle body mousemove. *