Skip to content

Commit f831f02

Browse files
author
Chris K
committed
Fixed issue with different tooltip handlers clsoe to each other.
1 parent e94873a commit f831f02

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/ui-scripts/tooltip/tooltip.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ Tooltips.CSS_TOOLTIP_SELECTED = "tooltip-selected";
9595

9696
const DATA_TOOLTIP = "data-tooltip";
9797
const DATA_TOOLTIP_TEXT = "data-tooltip-text";
98-
const HIDE_DELAY = 120;
99-
const SHOW_DELAY = 110;
98+
const HIDE_DELAY = 50;
99+
const SHOW_DELAY = 40;
100+
const HOVER_DELAY = 70;
100101
const DISTANCE_X = 5;
101102
const DISTANCE_Y = 5;
102103
const MARGIN_Y = 30;
@@ -115,6 +116,8 @@ Tooltips.CSS_TOOLTIP_SELECTED = "tooltip-selected";
115116
var _window_height = 0;
116117
var _padding_width = -1;
117118
var _padding_height = -1;
119+
var _hover_delay = 0;
120+
var _hover_events = [];
118121

119122
var store_window_dimensions = function()
120123
{
@@ -129,11 +132,23 @@ Tooltips.CSS_TOOLTIP_SELECTED = "tooltip-selected";
129132

130133
_ctx_stack.push(_tooltip_ctxs[_ctx_stack.length]);
131134
_cur_ctx = _ctx_stack.last;
132-
}
135+
};
133136

134137
var _mouseover = function(event)
135138
{
136-
if (_contextmenu && _contextmenu.is_visible)
139+
_hover_events.push(event);
140+
if (!_hover_delay)
141+
_hover_delay = setTimeout(_handle_mouseover, HOVER_DELAY);
142+
};
143+
144+
var _handle_mouseover = function()
145+
{
146+
_hover_delay = 0;
147+
var event = _hover_events.last;
148+
while (_hover_events.length)
149+
_hover_events.pop();
150+
151+
if (!event || (_contextmenu && _contextmenu.is_visible))
137152
return;
138153

139154
var ele = event.target;

0 commit comments

Comments
 (0)