Fix leaving the window entirely leaves the server label hover text up.
This commit is contained in:
parent
704a0e3078
commit
9508a9afc6
7
kvui.py
7
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue