Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Llnl template bugs #1303

Merged
merged 2 commits into from
Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion hexrd/ui/interactive_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def toggle_boundaries(self, show):
lw=style['width'],
color=style['color']
)
if has_nan(patch.xy):
# This template contains more than one polygon and the last point
# should not be connected to the first. See Tardis IP for example.
shape.set_closed(False)
self.raw_axes.add_patch(shape)
if self.shape:
self.shape = self.raw_axes.patches.pop()
Expand Down Expand Up @@ -286,6 +290,9 @@ def on_press_rotate(self, event):
contains, info = self.shape.contains(event)
if not contains:
return
# FIXME: Need to come back to this to understand why we
# need to set the press value twice
self.press = self.shape.xy, event.xdata, event.ydata
self.center = self.get_midpoint()
self.shape.set_transform(self.ax.axes.transData)
self.press = self.shape.xy, event.xdata, event.ydata
Expand All @@ -297,7 +304,7 @@ def rotate_template(self, points, angle):
self.shape.set_xy(verts)

def on_rotate(self, event):
if self.press is None:
if self.press is None or event.inaxes != self.shape.axes:
return

x, y = self.center
Expand Down