Skip to content
Merged
Changes from all commits
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
15 changes: 9 additions & 6 deletions arcade/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ def remove_section(self, section: Section) -> None:
section.on_hide_section()

section._view = None
if section in self.mouse_over_sections:
self.mouse_over_sections.remove(section)
self._sections.remove(section)

# keep sections order updated in the lists of sections
Expand Down Expand Up @@ -940,7 +942,7 @@ def dispatch_mouse_enter_leave_events(

prevent_dispatch_el = EVENT_UNHANDLED # prevent dispatch for enter/leave events
for section in before_sections:
if section not in current_sections:
if section.enabled and section not in current_sections:
if prevent_dispatch_el is EVENT_HANDLED:
break
# dispatch on_mouse_leave to before_section
Expand Down Expand Up @@ -1053,11 +1055,12 @@ def on_mouse_leave(self, x: int, y: int, *args, **kwargs) -> bool | None:
"""
prevent_dispatch = EVENT_UNHANDLED
for section in self.mouse_over_sections:
if prevent_dispatch is EVENT_HANDLED:
break
prevent_dispatch = self.dispatch_mouse_event(
"on_mouse_leave", x, y, *args, **kwargs, current_section=section
)
if section.enabled:
if prevent_dispatch is EVENT_HANDLED:
break
prevent_dispatch = self.dispatch_mouse_event(
"on_mouse_leave", x, y, *args, **kwargs, current_section=section
)
# clear the sections the mouse is over as it's out of the screen
self.mouse_over_sections = []
return prevent_dispatch
Expand Down
Loading