Skip to content

Commit

Permalink
feat(context-pad): add delay to mouseover
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Aug 4, 2023
1 parent 82a8a3d commit 3d35e11
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/features/context-pad/ContextPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,17 @@ ContextPad.prototype.trigger = function(action, event, autoActivate) {
originalEvent = event.originalEvent || event;

if (action === 'mouseover') {
this._mouseout = this.triggerEntry(entry, 'hover', originalEvent, autoActivate);
} else if (action === 'mouseout' && this._mouseout) {
this._mouseout();
this._timeout = setTimeout(() => {
this._mouseout = this.triggerEntry(entry, 'hover', originalEvent, autoActivate);
}, 200);
} else if (action === 'mouseout') {
clearTimeout(this._timeout);

this._mouseout = null;
if (this._mouseout) {
this._mouseout();

this._mouseout = null;
}
}

return this.triggerEntry(entry, action, originalEvent, autoActivate);
Expand Down

0 comments on commit 3d35e11

Please sign in to comment.