From f17892c411f21f8ad8283e146f30d4c3c0d69c91 Mon Sep 17 00:00:00 2001 From: prculley Date: Mon, 22 May 2017 17:41:27 -0500 Subject: [PATCH] Fix click/drag in media reference editor Fix so click/drag creates/updates selection using left mouse button. Fixes #8429. --- gramps/gui/widgets/selectionwidget.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/gramps/gui/widgets/selectionwidget.py b/gramps/gui/widgets/selectionwidget.py index 55c6bb08d..26e3e989d 100644 --- a/gramps/gui/widgets/selectionwidget.py +++ b/gramps/gui/widgets/selectionwidget.py @@ -694,7 +694,8 @@ class SelectionWidget(Gtk.ScrolledWindow): return if event.button == 1: # left button 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.selection = None self.refresh() @@ -724,18 +725,23 @@ class SelectionWidget(Gtk.ScrolledWindow): if self.start_point_screen: if self.current is not None: # a box is currently selected - if self.grabber is None: - # clicked outside of the grabbing area - self.current = None - self.selection = None - self.emit("selection-cleared") - elif self.grabber != INSIDE: + if self.grabber and self.grabber != INSIDE: # clicked on one of the grabbers dx, dy = (event.x - self.start_point_screen[0], event.y - self.start_point_screen[1]) self.grabber_to_draw = self._modify_selection(dx, dy) self.current.set_coords(*self.selection) 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: # nothing is currently selected if (minimum_region(self.start_point_screen, @@ -774,10 +780,11 @@ class SelectionWidget(Gtk.ScrolledWindow): dx, dy = (event.x - self.start_point_screen[0], event.y - self.start_point_screen[1]) self.grabber_to_draw = self._modify_selection(dx, dy) - elif self._can_select(): + else: # making new selection start_point = self._screen_to_truncated(self.start_point_screen) self.selection = order_coordinates(start_point, end_point) + else: # motion (mouse button is not pressed) self.in_region = self._find_region(*end_point_orig)