Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/278030
Change subject: Remove rotation animation from listrotator ...................................................................... Remove rotation animation from listrotator This is a first step, so each patch is as small as possible and always leaves the UI in a non-broken and non-broken looking state. This removes the rotation animation when you click on an other geo precision or globe, or a date precision or calendar model. The number, position and behavior of all UI elements is untouched. The only difference is that clicks are now instant. Bug: T109455 Bug: T109457 Change-Id: I19e628ae9072935bcf6299a8053f2544a9817117 --- M lib/jquery.ui/jquery.ui.listrotator.js 1 file changed, 1 insertion(+), 93 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/data-values/value-view refs/changes/30/278030/1 diff --git a/lib/jquery.ui/jquery.ui.listrotator.js b/lib/jquery.ui/jquery.ui.listrotator.js index ef9b474..98f54b8 100644 --- a/lib/jquery.ui/jquery.ui.listrotator.js +++ b/lib/jquery.ui/jquery.ui.listrotator.js @@ -76,13 +76,6 @@ * @param {Object} [options.menu.position=Object] * Default object passed to `jQuery.ui.position` when positioning the menu. Positions will be * flipped if isRtl option returns `true`. - * @param {Object} [options.animation=Object] - * Object containing parameters used for the rotation animation. - * @param {string[]} [options.animation.margins=['-15px', '15px']] - * Defines how far the sections should be shifted when animating the rotation. First value - * when shifting to the left and vice versa. Values will be flipped in rtl context. - * @param {number} [options.animation.duration=150] - * Defines the animation's duration in milliseconds. * @param {boolean} [options.deferInit=false] * Whether to defer initializing the section widths until `initWidths()` is called * "manually". @@ -114,10 +107,6 @@ at: 'left bottom', collision: 'none' } - }, - animation: { - margins: ['-15px', '15px'], - duration: 150 // TODO: Fixed values can't be changed nor turned off }, deferInit: false, messages: { @@ -167,14 +156,6 @@ * @readonly */ $menu: null, - - /** - * Temporarily caching the value the rotator is rotating to while the animation is being - * performed. - * @property {*} - * @protected - */ - _rotatingTo: null, /** * @see jQuery.Widget._create @@ -479,7 +460,7 @@ self.activate(); } ); - this.rotate( newValue ); + this._trigger( 'selected', null, [ this.value( newValue ) ] ); }, /** @@ -496,79 +477,6 @@ prev: function() { this._setValue( this.$prev.data( 'value' ) ); this.activate(); - }, - - /** - * Performs the rotation of the widget. - * - * @param {string} newValue - */ - rotate: function( newValue ) { - if ( newValue === this._rotatingTo - || !this._rotatingTo && newValue === this.$curr.data( 'value' ) - ) { - // Rotation is to the given target is in progress or has been performed already. - return; - } - - var self = this, - margins = $.merge( [], this.options.animation.margins ), - s = '.' + this.widgetBaseClass + '-label'; - - // Nodes that shall be animated: - var $nodes = this.$prev.children( s ) - .add( this.$curr.children( s ) ) - .add( this.$next.children( s ) ); - - // Set the rotation target: - this._rotatingTo = newValue; - - // Figure out whether rotating to the right or to the left: - var beforeCurrent = true; - $.each( this.options.values, function( i, v ) { - if ( v.value === newValue ) { - return false; - } - if ( v.value === self.$curr.data( 'value' ) ) { - beforeCurrent = false; - return false; - } - } ); - - if ( beforeCurrent ) { - margins.reverse(); - } - - if ( this._isRtl() ) { - margins.reverse(); - } - - $nodes.animate( - { - marginLeft: margins[0], - marginRight: margins[1], - opacity: 0 - }, { - done: function() { - // Reset margins an opacity used for the animation effect: - $nodes.css( { - marginLeft: '0', - marginRight: '0', - opacity: 1 - } ); - - // Rotation target changed in the meantime, just abort selecting: - if ( self._rotatingTo !== newValue ) { - return; - } - - self._trigger( 'selected', null, [ self.value( newValue ) ] ); - - self._rotatingTo = null; - }, - duration: this.options.animation.duration - } - ); }, /** -- To view, visit https://gerrit.wikimedia.org/r/278030 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I19e628ae9072935bcf6299a8053f2544a9817117 Gerrit-PatchSet: 1 Gerrit-Project: data-values/value-view Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits