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
|
||||
* @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#
|
||||
*/
|
||||
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;
|
||||
|
@ -24,6 +24,7 @@ define([
|
||||
'EventEmitter',
|
||||
'./MCT',
|
||||
'./api/Type',
|
||||
'./api/ui/GestureAPI',
|
||||
'./Registry',
|
||||
'./selection/Selection',
|
||||
'./selection/ContextManager',
|
||||
@ -35,6 +36,7 @@ define([
|
||||
EventEmitter,
|
||||
MCT,
|
||||
Type,
|
||||
GestureAPI,
|
||||
Registry,
|
||||
Selection,
|
||||
ContextManager,
|
||||
@ -72,11 +74,7 @@ define([
|
||||
|
||||
openmct.selection = selection;
|
||||
openmct.inspectors = new ViewRegistry();
|
||||
|
||||
openmct.gestures = {
|
||||
selectable: select.apply.bind(select),
|
||||
contextual: contextMenu.apply.bind(contextMenu)
|
||||
};
|
||||
openmct.gestures = new GestureAPI(select, contextMenu);
|
||||
|
||||
return openmct;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user