mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 07:16:39 +00:00
[API] Update GestureAPI to match docs
This commit is contained in:
parent
d4d9f9c467
commit
6fe1e775e0
@ -4,8 +4,9 @@ define([], function () {
|
|||||||
* @interface GestureAPI
|
* @interface GestureAPI
|
||||||
* @memberof module:openmct
|
* @memberof module:openmct
|
||||||
*/
|
*/
|
||||||
function GestureAPI() {
|
function GestureAPI(selectGesture, contextMenuGesture) {
|
||||||
|
this.selectGesture = selectGesture;
|
||||||
|
this.contextMenuGesture = contextMenuGesture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +22,24 @@ define([], function () {
|
|||||||
* @memberof module:openmct.GestureAPI#
|
* @memberof module:openmct.GestureAPI#
|
||||||
*/
|
*/
|
||||||
GestureAPI.prototype.selectable = function (htmlElement, item) {
|
GestureAPI.prototype.selectable = function (htmlElement, item) {
|
||||||
|
return this.selectGesture.apply(htmlElement, item);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Designate an HTML element as having a context menu associated with
|
||||||
|
* the provided item.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {HTMLElement} htmlElement the element to make selectable
|
||||||
|
* @param {*} item the object for which a context menu should appear
|
||||||
|
* @returns {Function} a function to remove this geture from this
|
||||||
|
* HTML element.
|
||||||
|
* @method selectable
|
||||||
|
* @memberof module:openmct.GestureAPI#
|
||||||
|
*/
|
||||||
|
GestureAPI.prototype.contextMenu = function (htmlElement, item) {
|
||||||
|
return this.contextMenuGesture.apply(htmlElement, item);
|
||||||
};
|
};
|
||||||
|
|
||||||
return GestureAPI;
|
return GestureAPI;
|
||||||
|
@ -24,6 +24,7 @@ define([
|
|||||||
'EventEmitter',
|
'EventEmitter',
|
||||||
'./MCT',
|
'./MCT',
|
||||||
'./api/Type',
|
'./api/Type',
|
||||||
|
'./api/ui/GestureAPI',
|
||||||
'./Registry',
|
'./Registry',
|
||||||
'./selection/Selection',
|
'./selection/Selection',
|
||||||
'./selection/ContextManager',
|
'./selection/ContextManager',
|
||||||
@ -35,6 +36,7 @@ define([
|
|||||||
EventEmitter,
|
EventEmitter,
|
||||||
MCT,
|
MCT,
|
||||||
Type,
|
Type,
|
||||||
|
GestureAPI,
|
||||||
Registry,
|
Registry,
|
||||||
Selection,
|
Selection,
|
||||||
ContextManager,
|
ContextManager,
|
||||||
@ -72,11 +74,7 @@ define([
|
|||||||
|
|
||||||
openmct.selection = selection;
|
openmct.selection = selection;
|
||||||
openmct.inspectors = new ViewRegistry();
|
openmct.inspectors = new ViewRegistry();
|
||||||
|
openmct.gestures = new GestureAPI(select, contextMenu);
|
||||||
openmct.gestures = {
|
|
||||||
selectable: select.apply.bind(select),
|
|
||||||
contextual: contextMenu.apply.bind(contextMenu)
|
|
||||||
};
|
|
||||||
|
|
||||||
return openmct;
|
return openmct;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user