mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-18 01:40:34 +00:00
18c3b0a87a
* eslint-config-wikimedia: 0.28.0 → 0.28.2 * grunt-stylelint: 0.20.0 → 0.20.1 * stylelint-config-wikimedia: 0.17.1 → 0.17.2 Change-Id: I798f739b5b2f12e5c6eedc88ecac557de28be129
63 lines
977 B
JavaScript
63 lines
977 B
JavaScript
const 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 );
|
|
}
|
|
|
|
Object.assign( 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;
|