Skip to content

Avoid UnboundLocalError in drag_pan. #10492

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

Merged
merged 1 commit into from
Feb 16, 2018
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
4 changes: 3 additions & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4014,7 +4014,7 @@ def format_deltas(key, dx, dy):
p = self._pan_start
dx = x - p.x
dy = y - p.y
if dx == 0 and dy == 0:
if dx == dy == 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, cool. I didn't realize you could do that with equals. I just always thought it was a special case in the interpreter for the < and > to do "between" tests.

return
if button == 1:
dx, dy = format_deltas(key, dx, dy)
Expand All @@ -4035,6 +4035,8 @@ def format_deltas(key, dx, dy):
except OverflowError:
warnings.warn('Overflow while panning')
return
else:
return

valid = np.isfinite(result.transformed(p.trans))
points = result.get_points().astype(object)
Expand Down