Use once to call event handler just one time
Use dedicated option, don't do it manually. https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#once Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I2bce09c496ca7dd3267514bbb30308b7f7afe4f9
This commit is contained in:
parent
d331120059
commit
6546ab4501
1 changed files with 2 additions and 3 deletions
|
@ -1033,11 +1033,10 @@ L.Control.UIManager = L.Control.extend({
|
|||
elem.tooltip('option', 'items', elem[0]);
|
||||
elem.tooltip('option', 'position', { my: 'left bottom', at: 'left+' + pt.x + ' top+' + pt.y, collision: 'fit fit' });
|
||||
elem.tooltip('open');
|
||||
document.addEventListener('mousemove', function closeTooltip() {
|
||||
document.addEventListener('mousemove', function() {
|
||||
elem.tooltip('close');
|
||||
elem.tooltip('disable');
|
||||
document.removeEventListener('mousemove', closeTooltip);
|
||||
});
|
||||
}, {once: true});
|
||||
},
|
||||
|
||||
// Snack bar
|
||||
|
|
Loading…
Reference in a new issue