mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 01:42:31 +00:00
[Info Bubble] Begin adding info gesture
Begin adding info gesture, which will attach info bubbles to representations of domain objects. WTD-884.
This commit is contained in:
parent
179b0b46e5
commit
05a78f70e3
@ -34,6 +34,25 @@
|
||||
"attributes": [ "bubbleTitle", "bubbleLayout" ],
|
||||
"alias": "bubble"
|
||||
}
|
||||
],
|
||||
"gestures": [
|
||||
{
|
||||
"key": "info",
|
||||
"implementation": "gestures/InfoGesture.js",
|
||||
"depends": [ "infoService" ]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "infoService",
|
||||
"implementation": "services/InfoService.js",
|
||||
"depends": [
|
||||
"$compile",
|
||||
"$document",
|
||||
"$window",
|
||||
"$rootScope"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
45
platform/commonUI/inspect/src/gestures/InfoGesture.js
Normal file
45
platform/commonUI/inspect/src/gestures/InfoGesture.js
Normal file
@ -0,0 +1,45 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function InfoGesture(infoService, element, domainObject) {
|
||||
var dismissBubble;
|
||||
|
||||
function hideBubble() {
|
||||
if (dismissBubble) {
|
||||
dismissBubble();
|
||||
element.off('mouseleave', hideBubble);
|
||||
dismissBubble = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function showBubble(event) {
|
||||
dismissBubble = infoService.display(
|
||||
"info-table",
|
||||
domainObject.getName(),
|
||||
[
|
||||
{ name: "ID", value: domainObject.getId() }
|
||||
],
|
||||
[ event.clientX, event.clientY ]
|
||||
);
|
||||
element.on('mouseleave', hideBubble);
|
||||
}
|
||||
|
||||
element.on('mouseenter', showBubble);
|
||||
|
||||
return {
|
||||
destroy: function () {
|
||||
hideBubble();
|
||||
element.off('mouseenter', showBubble);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return InfoGesture;
|
||||
|
||||
}
|
||||
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user