Esanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/89811
Change subject: Add more resize events ...................................................................... Add more resize events 'resize' is actually 'resizeEnd'. Added 'resizeStart' and 'resizing' which is triggered on mouse move. Change-Id: I13c6e426cbcc965b3db50082c5294ca76979fe57 --- M modules/ve/ce/ve.ce.FocusableNode.js M modules/ve/ce/ve.ce.RelocatableNode.js M modules/ve/ce/ve.ce.ResizableNode.js 3 files changed, 26 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/11/89811/1 diff --git a/modules/ve/ce/ve.ce.FocusableNode.js b/modules/ve/ce/ve.ce.FocusableNode.js index 5c970ec..0b3c898 100644 --- a/modules/ve/ce/ve.ce.FocusableNode.js +++ b/modules/ve/ce/ve.ce.FocusableNode.js @@ -16,7 +16,7 @@ * node's DOM rendering. * * If your focusable node changes size and the highlight must be redrawn, call redrawHighlight(). - * 'resize' and 'rerender' are already bound to call this. + * 'resizeEnd' and 'rerender' are already bound to call this. * * @class * @abstract @@ -34,7 +34,7 @@ // Events this.connect( this, { 'setup': 'onFocusableSetup', - 'resize': 'onFocusableResize', + 'resizeEnd': 'onFocusableResize', 'rerender': 'onFocusableRerender', 'live': 'onFocusableLive' } ); diff --git a/modules/ve/ce/ve.ce.RelocatableNode.js b/modules/ve/ce/ve.ce.RelocatableNode.js index f91e663..d4b15f4 100644 --- a/modules/ve/ce/ve.ce.RelocatableNode.js +++ b/modules/ve/ce/ve.ce.RelocatableNode.js @@ -26,7 +26,7 @@ this.connect( this, { 'focus': 'onRelocatableFocus', 'blur': 'onRelocatableBlur', - 'resize': 'onRelocatableResize', + 'resizeEnd': 'onRelocatableResize', 'live': 'onRelocatableLive' } ); diff --git a/modules/ve/ce/ve.ce.ResizableNode.js b/modules/ve/ce/ve.ce.ResizableNode.js index 3c40266..f33bf93 100644 --- a/modules/ve/ce/ve.ce.ResizableNode.js +++ b/modules/ve/ce/ve.ce.ResizableNode.js @@ -29,7 +29,7 @@ 'focus': 'onResizableFocus', 'blur': 'onResizableBlur', 'live': 'onResizableLive', - 'resize': 'onResizableFocus' + 'resizeEnd': 'onResizableFocus' } ); // Initialization @@ -40,6 +40,22 @@ .append( this.$$( '<div>' ).addClass( 've-ce-resizableNode-seHandle' ) ) .append( this.$$( '<div>' ).addClass( 've-ce-resizableNode-swHandle' ) ); }; + +/* Events */ + +/** + * @event resizeStart + */ + +/** + * @event resizing + * @param {Object} dimensions Dimension object containing width & height + */ + +/** + * @event resizeEnd + */ + /* Static Properties */ @@ -108,6 +124,7 @@ * * @method * @param {jQuery.Event} e Click event + * @emits resizeStart */ ve.ce.ResizableNode.prototype.onResizeHandlesCornerMouseDown = function ( e ) { // Hide context menu @@ -142,6 +159,7 @@ 'mousemove.ve-ce-resizableNode': ve.bind( this.onDocumentMouseMove, this ), 'mouseup.ve-ce-resizableNode': ve.bind( this.onDocumentMouseUp, this ) } ); + this.emit( 'resizeStart' ); return false; }; @@ -181,6 +199,7 @@ * * @method * @param {jQuery.Event} e Click event + * @emits resizing */ ve.ce.ResizableNode.prototype.onDocumentMouseMove = function ( e ) { var newWidth, newHeight, newRatio, snapMin, snapMax, snap, @@ -260,6 +279,7 @@ // Update bounding box this.$resizeHandles.css( dimensions ); + this.emit( 'resizing', dimensions ); } }; @@ -267,6 +287,7 @@ * Handle body mouseup. * * @method + * @emits resizeEnd */ ve.ce.ResizableNode.prototype.onDocumentMouseUp = function () { var attrChanges, @@ -294,7 +315,7 @@ // user doesn't perform a drag this.root.getSurface().getSurface().getContext().update(); - this.emit( 'resize' ); + this.emit( 'resizeEnd' ); }; /** -- To view, visit https://gerrit.wikimedia.org/r/89811 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I13c6e426cbcc965b3db50082c5294ca76979fe57 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits