Fix leaving the window entirely leaves the server label hover text up.

This commit is contained in:
CaitSith2
2021-10-31 08:07:37 -07:00
parent 704a0e3078
commit 9508a9afc6

View File

@@ -45,6 +45,7 @@ class HoverBehavior(object):
self.register_event_type('on_enter')
self.register_event_type('on_leave')
Window.bind(mouse_pos=self.on_mouse_pos)
Window.bind(on_cursor_leave=self.on_cursor_leave)
super(HoverBehavior, self).__init__(**kwargs)
def on_mouse_pos(self, *args):
@@ -63,6 +64,12 @@ class HoverBehavior(object):
else:
self.dispatch("on_leave")
def on_cursor_leave(self, *args):
# if the mouse left the window, it is obviously no longer inside the hover label.
self.hovered = BooleanProperty(False)
self.border_point = ObjectProperty(None)
self.dispatch("on_leave")
Factory.register('HoverBehavior', HoverBehavior)