mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 08:03:49 +00:00
[Info Bubble] Fix display issues
Intermediary commit; fix some display issues with info bubbles, add some delay. WTD-884.
This commit is contained in:
@ -5,8 +5,10 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function InfoGesture(infoService, element, domainObject) {
|
||||
var dismissBubble;
|
||||
function InfoGesture($timeout, infoService, DELAY, element, domainObject) {
|
||||
var dismissBubble,
|
||||
pendingBubble,
|
||||
mousePosition;
|
||||
|
||||
function hideBubble() {
|
||||
if (dismissBubble) {
|
||||
@ -14,20 +16,36 @@ define(
|
||||
element.off('mouseleave', hideBubble);
|
||||
dismissBubble = undefined;
|
||||
}
|
||||
if (pendingBubble) {
|
||||
$timeout.cancel(pendingBubble);
|
||||
pendingBubble = undefined;
|
||||
}
|
||||
mousePosition = undefined;
|
||||
}
|
||||
|
||||
function trackPosition(event) {
|
||||
mousePosition = [ event.clientX, event.clientY ];
|
||||
}
|
||||
|
||||
function showBubble(event) {
|
||||
dismissBubble = infoService.display(
|
||||
"info-table",
|
||||
domainObject.getName(),
|
||||
[
|
||||
{ name: "ID", value: domainObject.getId() }
|
||||
],
|
||||
[ event.clientX, event.clientY ]
|
||||
);
|
||||
trackPosition(event);
|
||||
|
||||
pendingBubble = $timeout(function () {
|
||||
dismissBubble = infoService.display(
|
||||
"info-table",
|
||||
domainObject.getModel().name,
|
||||
[
|
||||
{ name: "ID", value: domainObject.getId() }
|
||||
],
|
||||
mousePosition
|
||||
);
|
||||
pendingBubble = undefined;
|
||||
}, DELAY);
|
||||
|
||||
element.on('mouseleave', hideBubble);
|
||||
}
|
||||
|
||||
element.on('mousemove', trackPosition);
|
||||
element.on('mouseenter', showBubble);
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user