Skip to content

Commit af3796a

Browse files
committed
Prevent drawing when interacting
Signed-off-by: Brianna Major <[email protected]>
1 parent ec58684 commit af3796a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

hexrd/ui/mask_regions_dialog.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,22 @@ def snap_rectangle_to_edges(self, event):
178178
self.drag_motion(event)
179179

180180
def check_pick(self, event):
181+
pick_found = False
181182
for templates in self.interactive_templates.values():
182183
for it in templates:
183184
it.static_mode = True
184185
transformed_click = it.template.get_transform().transform(
185186
(event.xdata, event.ydata))
186-
if it.template.contains_point(transformed_click):
187+
if (not pick_found and
188+
it.template.contains_point(transformed_click) and
189+
event.inaxes.get_title() == it.detector):
187190
if self.interactive_template:
188191
self.interactive_template.disconnect()
189192
self.interactive_template = it
190193
self.interactive_template.static_mode = False
194+
self.interactive_template.on_press(event)
195+
pick_found = True
196+
return pick_found
191197

192198
def button_pressed(self, event):
193199
if self.image_mode not in (ViewType.raw, ViewType.polar):
@@ -199,9 +205,10 @@ def button_pressed(self, event):
199205

200206
if event.button == 1:
201207
# Determine if selecting an existing template or drawing a new one
202-
self.check_pick(event)
208+
pick_found = self.check_pick(event)
203209

204-
if (self.interactive_template and
210+
if (pick_found or
211+
self.interactive_template and
205212
not self.interactive_template.static_mode):
206213
return
207214

0 commit comments

Comments
 (0)