Commit 771daee0 authored by Alexandru Băluț's avatar Alexandru Băluț

viewer: Fix handle unhover when cursor leaves widget

parent 276bd2f7
......@@ -149,8 +149,12 @@ class Handle:
self.__update_window_position()
def on_hover(self, cursor_pos):
distance = numpy.linalg.norm(self.__window_position - cursor_pos)
if cursor_pos is None:
# The cursor is out of the widget.
self.hovered = False
return
distance = numpy.linalg.norm(self.__window_position - cursor_pos)
if distance < self.__radius:
self.hovered = True
self._overlay.stack.set_cursor(Handle.CURSORS[self.placement])
......@@ -545,6 +549,11 @@ class MoveScaleOverlay(Overlay):
self.queue_draw()
return self._is_hovered()
def unhover(self):
if self.hovered_handle:
self.hovered_handle.on_hover(None)
Overlay.unhover(self)
def update_from_source(self):
self.__set_size(self.__get_source_size() / self.project_size)
self.__set_position(self.__get_source_position() / self.project_size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment