Fix click/drag in media reference editor
Fix so click/drag creates/updates selection using left mouse button. Fixes #8429.
This commit is contained in:
parent
007c1cb1d6
commit
f17892c411
@ -694,7 +694,8 @@ class SelectionWidget(Gtk.ScrolledWindow):
|
|||||||
return
|
return
|
||||||
if event.button == 1: # left button
|
if event.button == 1: # left button
|
||||||
self.start_point_screen = (event.x, event.y)
|
self.start_point_screen = (event.x, event.y)
|
||||||
if self.current is not None and self.grabber is None:
|
if self.current is not None and self.grabber is None and \
|
||||||
|
self.multiple_selection:
|
||||||
self.current = None
|
self.current = None
|
||||||
self.selection = None
|
self.selection = None
|
||||||
self.refresh()
|
self.refresh()
|
||||||
@ -724,18 +725,23 @@ class SelectionWidget(Gtk.ScrolledWindow):
|
|||||||
if self.start_point_screen:
|
if self.start_point_screen:
|
||||||
if self.current is not None:
|
if self.current is not None:
|
||||||
# a box is currently selected
|
# a box is currently selected
|
||||||
if self.grabber is None:
|
if self.grabber and self.grabber != INSIDE:
|
||||||
# clicked outside of the grabbing area
|
|
||||||
self.current = None
|
|
||||||
self.selection = None
|
|
||||||
self.emit("selection-cleared")
|
|
||||||
elif self.grabber != INSIDE:
|
|
||||||
# clicked on one of the grabbers
|
# clicked on one of the grabbers
|
||||||
dx, dy = (event.x - self.start_point_screen[0],
|
dx, dy = (event.x - self.start_point_screen[0],
|
||||||
event.y - self.start_point_screen[1])
|
event.y - self.start_point_screen[1])
|
||||||
self.grabber_to_draw = self._modify_selection(dx, dy)
|
self.grabber_to_draw = self._modify_selection(dx, dy)
|
||||||
self.current.set_coords(*self.selection)
|
self.current.set_coords(*self.selection)
|
||||||
self.emit("region-modified")
|
self.emit("region-modified")
|
||||||
|
elif self.grabber is None and self.multiple_selection:
|
||||||
|
# clicked outside of the grabbing area
|
||||||
|
self.current = None
|
||||||
|
self.selection = None
|
||||||
|
self.emit("selection-cleared")
|
||||||
|
else:
|
||||||
|
# update current selection
|
||||||
|
self.current.set_coords(*self.selection)
|
||||||
|
self.region = self.current
|
||||||
|
self.emit("region-modified")
|
||||||
else:
|
else:
|
||||||
# nothing is currently selected
|
# nothing is currently selected
|
||||||
if (minimum_region(self.start_point_screen,
|
if (minimum_region(self.start_point_screen,
|
||||||
@ -774,10 +780,11 @@ class SelectionWidget(Gtk.ScrolledWindow):
|
|||||||
dx, dy = (event.x - self.start_point_screen[0],
|
dx, dy = (event.x - self.start_point_screen[0],
|
||||||
event.y - self.start_point_screen[1])
|
event.y - self.start_point_screen[1])
|
||||||
self.grabber_to_draw = self._modify_selection(dx, dy)
|
self.grabber_to_draw = self._modify_selection(dx, dy)
|
||||||
elif self._can_select():
|
else:
|
||||||
# making new selection
|
# making new selection
|
||||||
start_point = self._screen_to_truncated(self.start_point_screen)
|
start_point = self._screen_to_truncated(self.start_point_screen)
|
||||||
self.selection = order_coordinates(start_point, end_point)
|
self.selection = order_coordinates(start_point, end_point)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# motion (mouse button is not pressed)
|
# motion (mouse button is not pressed)
|
||||||
self.in_region = self._find_region(*end_point_orig)
|
self.in_region = self._find_region(*end_point_orig)
|
||||||
|
Loading…
Reference in New Issue
Block a user