8000 Fix bug in SpanSelector, introduced in commit #dd325759 · matplotlib/matplotlib@2e31f66 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e31f66

Browse files
committed
Fix bug in SpanSelector, introduced in commit #dd325759
The useblit attribute was being set after calling new_axes, but new_axes needs that attribute. By setting useblit before calling new_axes, we set it based on the initial canvas; even though new_axes might change to a different canvas, we assume it will be the same type of canvas (same backend), so its supports_blit attribute will not change.
1 parent b009b63 commit 2e31f66

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/widgets.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,12 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
10721072
self.buttonDown = False
10731073
self.prev = (0, 0)
10741074

1075+
# Set useblit based on original canvas.
1076+
self.useblit = useblit and self.canvas.supports_blit
1077+
10751078
# Reset canvas so that `new_axes` connects events.
10761079
self.canvas = None
10771080
self.new_axes(ax)
1078-
self.useblit = useblit and self.canvas.supports_blit
10791081

10801082
def new_axes(self, ax):
10811083
self.ax = ax

0 commit comments

Comments
 (0)
0