Prevent context menu from flickering after FocusableNode redraw

Pass an extra parameter to show() to let it know when the menu is
just being moved, and therefore doesn't need to perform the fade-in
transition.

Change-Id: I2cf2ff07db6cc7d226f3d626755792a06dfcbe54
This commit is contained in:
Ed Sanders 2013-09-26 21:39:54 +01:00
parent 515ad01713
commit 241f146c8a
2 changed files with 7 additions and 3 deletions

View file

@ -107,7 +107,7 @@ ve.ce.FocusableNode.prototype.onFocusableRerender = function () {
if ( this.focused ) {
this.redrawHighlight();
// reposition menu
this.surface.getSurface().getContext().show( true );
this.surface.getSurface().getContext().show( true, true );
}
};

View file

@ -320,9 +320,11 @@ ve.ui.Context.prototype.updateDimensions = function ( transition ) {
* Shows the context menu.
*
* @method
* @param {boolean} [transition=false] Use a smooth transition
* @param {boolean} [repositionOnly=false] The context is only being moved so don't fade in
* @chainable
*/
ve.ui.Context.prototype.show = function ( transition ) {
ve.ui.Context.prototype.show = function ( transition, repositionOnly ) {
var inspector = this.inspectors.getCurrent(),
focusedNode = this.surface.getView().getFocusedNode();
@ -336,7 +338,9 @@ ve.ui.Context.prototype.show = function ( transition ) {
if ( inspector ) {
this.$menu.hide();
this.inspectors.$.show();
inspector.$.css( 'opacity', 0 );
if ( !repositionOnly ) {
inspector.$.css( 'opacity', 0 );
}
// Update size and fade the inspector in after animation is complete
setTimeout( ve.bind( function () {
inspector.fitHeightToContents();