Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #17772 on branch v3.3.x (Partially fix rubberbanding in GTK3.) #17812

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
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
12 changes: 6 additions & 6 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def set_cursor(self, cursor):
def draw_rubberband(self, event, x0, y0, x1, y1):
# adapted from
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744
self.ctx = self.canvas.get_property("window").cairo_create()
ctx = self.canvas.get_property("window").cairo_create()

# todo: instead of redrawing the entire figure, copy the part of
# the figure that was covered by the previous rubberband rectangle
Expand All @@ -522,11 +522,11 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
h = abs(y1 - y0)
rect = [int(val) for val in (min(x0, x1), min(y0, y1), w, h)]

self.ctx.new_path()
self.ctx.set_line_width(0.5)
self.ctx.rectangle(rect[0], rect[1], rect[2], rect[3])
self.ctx.set_source_rgb(0, 0, 0)
self.ctx.stroke()
ctx.new_path()
ctx.set_line_width(0.5)
ctx.rectangle(rect[0], rect[1], rect[2], rect[3])
ctx.set_source_rgb(0, 0, 0)
ctx.stroke()

def _update_buttons_checked(self):
for name, active in [("Pan", "PAN"), ("Zoom", "ZOOM")]:
Expand Down