From 9508a9afc6c53b3f1cfd3afca23ee7284dfa44c3 Mon Sep 17 00:00:00 2001 From: CaitSith2 Date: Sun, 31 Oct 2021 08:07:37 -0700 Subject: [PATCH] Fix leaving the window entirely leaves the server label hover text up. --- kvui.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kvui.py b/kvui.py index 5b3a5afd..f80b0011 100644 --- a/kvui.py +++ b/kvui.py @@ -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)