Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow layers to utilise CoreEventHandler mouseleave options #705

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: register mouseleave unbind
  • Loading branch information
itsbjoern committed Sep 27, 2024
commit 9798c0fc2e8343d7c2f17042a4da5ce654cb9cc9
12 changes: 8 additions & 4 deletions packages/core/src/events/DefaultEventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ export class DefaultEventHandlers<O = {}> extends CoreEventHandlers<
let unbindMouseleave: (() => void) | null = null;

if (this.options.removeHoverOnMouseleave) {
this.addCraftEventListener(el, 'mouseleave', (e) => {
e.craft.stopPropagation();
store.actions.setNodeEvent('hovered', null);
});
unbindMouseleave = this.addCraftEventListener(
el,
'mouseleave',
(e) => {
e.craft.stopPropagation();
store.actions.setNodeEvent('hovered', null);
}
);
}

return () => {
Expand Down