mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
[Browse] Add JSDoc
Add in-line documentation to controller which supports the moveable splitter in Browse mode, WTD-747.
This commit is contained in:
@ -5,35 +5,46 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for the splitter in Browse mode. Current implementation
|
||||||
|
* uses many hard-coded constants; this could be generalized.
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
function SplitPaneController() {
|
function SplitPaneController() {
|
||||||
var minimum = 120,
|
var minimum = 120,
|
||||||
maximum = 600,
|
maximum = 600,
|
||||||
current = 200,
|
current = 200,
|
||||||
start = 200,
|
start = 200;
|
||||||
style;
|
|
||||||
|
|
||||||
function updateStyle() {
|
|
||||||
style = { left: current + 'px' };
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStyle();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
style: function () {
|
/**
|
||||||
return style;
|
* Get the current position of the splitter, in pixels
|
||||||
},
|
* from the left edge.
|
||||||
|
* @returns {number} position of the splitter, in pixels
|
||||||
|
*/
|
||||||
state: function () {
|
state: function () {
|
||||||
return current;
|
return current;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Begin moving the splitter; this will note the splitter's
|
||||||
|
* current position, which is necessary for correct
|
||||||
|
* interpretation of deltas provided by mct-drag.
|
||||||
|
*/
|
||||||
startMove: function () {
|
startMove: function () {
|
||||||
start = current;
|
start = current;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Move the splitter a number of pixels to the right
|
||||||
|
* (negative numbers move the splitter to the left.)
|
||||||
|
* This movement is relative to the position of the
|
||||||
|
* splitter when startMove was last invoked.
|
||||||
|
* @param {number} delta number of pixels to move
|
||||||
|
*/
|
||||||
move: function (delta) {
|
move: function (delta) {
|
||||||
current = Math.min(
|
current = Math.min(
|
||||||
maximum,
|
maximum,
|
||||||
Math.max(minimum, start + delta)
|
Math.max(minimum, start + delta)
|
||||||
);
|
);
|
||||||
updateStyle();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user