mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-14 19:24:42 +00:00
Minor fixes around log animation time
Addressing comments in Ic9fe89c7e3f984d3390260805e2480a0f8ffd0c9 Change-Id: I9a989946f50788d8b47f40a0aa00408b7aa86cb8
This commit is contained in:
parent
4197c50c28
commit
20edda4b82
|
@ -90,11 +90,11 @@
|
||||||
* Moves the pointer to a position
|
* Moves the pointer to a position
|
||||||
*
|
*
|
||||||
* @param {number} posInPx
|
* @param {number} posInPx
|
||||||
* @param {number} baseDuration - duration per revisionWidth, is adjusted by square root distance
|
|
||||||
* @param {number} revisionWidth
|
* @param {number} revisionWidth
|
||||||
|
* @param {number} [baseDuration] Duration per revisionWidth, is adjusted by log() distance
|
||||||
* @return {jQuery}
|
* @return {jQuery}
|
||||||
*/
|
*/
|
||||||
animateTo: function ( posInPx, baseDuration, revisionWidth ) {
|
animateTo: function ( posInPx, revisionWidth, baseDuration ) {
|
||||||
var animatePos = { left: posInPx },
|
var animatePos = { left: posInPx },
|
||||||
currentPos = this.getElement().position(),
|
currentPos = this.getElement().position(),
|
||||||
distance, duration;
|
distance, duration;
|
||||||
|
@ -111,12 +111,12 @@
|
||||||
* Slides the pointer to the revision it's pointing at
|
* Slides the pointer to the revision it's pointing at
|
||||||
*
|
*
|
||||||
* @param {Slider} slider
|
* @param {Slider} slider
|
||||||
* @param {number} duration
|
* @param {number} [duration]
|
||||||
* @return {jQuery}
|
* @return {jQuery}
|
||||||
*/
|
*/
|
||||||
slideToPosition: function ( slider, duration ) {
|
slideToPosition: function ( slider, duration ) {
|
||||||
var relativePos = this.pointer.getPosition() - slider.getOldestVisibleRevisionIndex();
|
var relativePos = this.pointer.getPosition() - slider.getOldestVisibleRevisionIndex();
|
||||||
return this.animateTo( ( relativePos - 1 ) * slider.getView().revisionWidth, duration, slider.getView().revisionWidth );
|
return this.animateTo( ( relativePos - 1 ) * slider.getView().revisionWidth, slider.getView().revisionWidth, duration );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,14 +124,14 @@
|
||||||
*
|
*
|
||||||
* @param {Slider} slider
|
* @param {Slider} slider
|
||||||
* @param {boolean} posBeforeSlider
|
* @param {boolean} posBeforeSlider
|
||||||
* @param {number} duration
|
* @param {number} [duration]
|
||||||
* @return {jQuery}
|
* @return {jQuery}
|
||||||
*/
|
*/
|
||||||
slideToSide: function ( slider, posBeforeSlider, duration ) {
|
slideToSide: function ( slider, posBeforeSlider, duration ) {
|
||||||
if ( posBeforeSlider ) {
|
if ( posBeforeSlider ) {
|
||||||
return this.animateTo( this.getOffset() - 2 * slider.getView().revisionWidth, duration, slider.getView().revisionWidth );
|
return this.animateTo( this.getOffset() - 2 * slider.getView().revisionWidth, slider.getView().revisionWidth, duration );
|
||||||
} else {
|
} else {
|
||||||
return this.animateTo( slider.getRevisionsPerWindow() * slider.getView().revisionWidth + this.getOffset(), duration, slider.getView().revisionWidth );
|
return this.animateTo( slider.getRevisionsPerWindow() * slider.getView().revisionWidth + this.getOffset(), slider.getView().revisionWidth, duration );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
* Decides based on its position whether the pointer should be sliding to the side or to its position
|
* Decides based on its position whether the pointer should be sliding to the side or to its position
|
||||||
*
|
*
|
||||||
* @param {Slider} slider
|
* @param {Slider} slider
|
||||||
* @param {number} duration
|
* @param {number} [duration]
|
||||||
* @return {jQuery}
|
* @return {jQuery}
|
||||||
*/
|
*/
|
||||||
slideToSideOrPosition: function ( slider, duration ) {
|
slideToSideOrPosition: function ( slider, duration ) {
|
||||||
|
|
Loading…
Reference in a new issue