Trevor Parscal has uploaded a new change for review.

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


Change subject: Fix transition animation between context menu/inspector
......................................................................

Fix transition animation between context menu/inspector

This removes the "grow from nothing" effect (which may have been a little 
overkill) but fixes the situation where the inspector is open and you click to 
a new location and it moves to the new location and then transitions down to 
the menu (which looks bad).

Change-Id: I19d27da6fea7c36965c83aa73836b1bc870c9bcc
---
M modules/ve/ui/ve.ui.Context.js
1 file changed, 17 insertions(+), 6 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 7cd79a3..5d987ba 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -126,6 +126,9 @@
  * @param {ve.ui.Inspector} inspector Inspector that's been opened
  */
 ve.ui.Context.prototype.onInspectorOpen = function () {
+       // Transition between menu and inspector
+       this.$body.addClass( 've-ui-context-body-transition' );
+
        this.show();
 };
 
@@ -137,7 +140,14 @@
  * @param {boolean} accept Changes have been accepted
  */
 ve.ui.Context.prototype.onInspectorClose = function () {
+       var $body = this.$body;
+
        this.update();
+
+       // Disable transitioning after transition completes
+       setTimeout( function () {
+               $body.removeClass( 've-ui-context-body-transition' );
+       }, 200 );
 };
 
 /**
@@ -173,6 +183,11 @@
                fragment = this.surface.getModel().getFragment(),
                selection = fragment.getRange(),
                inspector = this.inspectors.getCurrent();
+
+       // If the context about to be moved to a new location, don't transition 
it's size
+       if ( this.selection && this.selection.end !== selection.end ) {
+               this.$body.removeClass( 've-ui-context-body-transition' );
+       }
 
        if ( inspector && selection.equals( this.selection ) ) {
                // There's an inspector, and the selection hasn't changed, 
update the position
@@ -249,9 +264,7 @@
                this.$.css( { 'left': position.x, 'width': width, 'top': 
position.y } );
 
                if ( !this.visible ) {
-                       this.$body
-                               .css( { 'width': 0, 'height': 0, 'left': 0 } )
-                               .addClass( 've-ui-context-body-transition' );
+                       this.$body.css( { 'width': 0, 'height': 0, 'left': 0 } 
);
                }
 
                this.$body.css( { 'left': center, 'width': width, 'height': 
height } );
@@ -278,9 +291,7 @@
                return this;
        }
 
-       this.$body
-               .removeClass( 've-ui-context-body-transition' )
-               .css( { 'width': 0, 'height': 0, 'left': 0 } );
+       //this.$body.css( { 'width': 0, 'height': 0, 'left': 0 } );
        this.inspectors.$.hide();
        this.$menu.hide();
        this.$.hide();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19d27da6fea7c36965c83aa73836b1bc870c9bcc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to