mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-24 07:23:41 +00:00
319061c92a
It's never used in another context but together with the ….Slider module. Motivated by the confusion about the two types of require() introduced in Idf1cc79. Bug: T233279 Change-Id: I7c98a41051e6d83ab3524cb14a709002feec2d78
67 lines
1 KiB
JavaScript
67 lines
1 KiB
JavaScript
/**
|
|
* @external PointerLine
|
|
* @external PointerView
|
|
*/
|
|
var PointerLine = require( './ext.RevisionSlider.PointerLine.js' ),
|
|
PointerView = require( './ext.RevisionSlider.PointerView.js' );
|
|
|
|
/**
|
|
* Module containing logic for the revision pointers
|
|
*
|
|
* @class Pointer
|
|
* @param {string} name
|
|
* @constructor
|
|
*/
|
|
function Pointer( name ) {
|
|
this.view = new PointerView( this, name );
|
|
this.line = new PointerLine( this, name );
|
|
}
|
|
|
|
$.extend( Pointer.prototype, {
|
|
/**
|
|
* @type {number}
|
|
*/
|
|
position: 0,
|
|
|
|
/**
|
|
* @type {PointerView}
|
|
*/
|
|
view: null,
|
|
|
|
/**
|
|
* @type {PointerLine}
|
|
*/
|
|
line: null,
|
|
|
|
/**
|
|
* @param {number} p
|
|
*/
|
|
setPosition: function ( p ) {
|
|
this.position = p;
|
|
this.getView().setDataPositionAttribute( p );
|
|
},
|
|
|
|
/**
|
|
* @return {number}
|
|
*/
|
|
getPosition: function () {
|
|
return this.position;
|
|
},
|
|
|
|
/**
|
|
* @return {PointerView}
|
|
*/
|
|
getView: function () {
|
|
return this.view;
|
|
},
|
|
|
|
/**
|
|
* @return {PointerLine}
|
|
*/
|
|
getLine: function () {
|
|
return this.line;
|
|
}
|
|
} );
|
|
|
|
module.exports = Pointer;
|