hotspots: Debounce hotspot placement on UI updates by 10ms.

A small delay to ensure that the event (i.e. a click) has completed
and the UI has updated before hotspot icon and popover placement
is recomputed.
This commit is contained in:
Jack Zhang 2017-08-01 18:01:17 -07:00 committed by Tim Abbott
parent 5ce0db9f43
commit 1e40665e51
1 changed files with 2 additions and 2 deletions

View File

@ -239,10 +239,10 @@ function insert_hotspot_into_DOM(hotspot) {
// reposition on any event that might update the UI
['resize', 'scroll', 'onkeydown', 'click']
.forEach(function (event_name) {
window.addEventListener(event_name, function () {
window.addEventListener(event_name, _.debounce(function () {
place_icon(hotspot);
place_popover(hotspot);
}, true);
}, 10), true);
});
}, (hotspot.delay * 100));
}