@@ -1101,6 +1101,7 @@ def __init__(self, ax, onselect, useblit=False, button=None):
1101
1101
AxesWidget .__init__ (self , ax )
1102
1102
1103
1103
self .visible = True
1104
+ self .onselect = onselect
1104
1105
self .connect_default_events ()
1105
1106
1106
1107
self .background = None
@@ -1130,7 +1131,7 @@ def update_background(self, event):
1130
1131
self .background = self .canvas .copy_from_bbox (self .ax .bbox )
1131
1132
1132
1133
def connect_default_events (self ):
1133
- """Connect the major canvas events to methods.""" "
1134
+ """Connect the major canvas events to methods."""
1134
1135
self .connect_event ('motion_notify_event' , self ._onmove )
1135
1136
self .connect_event ('button_press_event' , self ._press )
1136
1137
self .connect_event ('button_release_event' , self ._release )
@@ -1357,7 +1358,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
1357
1358
def new_axes (self , ax ):
1358
1359
self .ax = ax
1359
1360
if self .canvas is not ax .figure .canvas :
1360
- self .disconnect_events ()
1361
+ if not self .canvas is None :
1362
+ self .disconnect_events ()
1361
1363
1362
1364
self .canvas = ax .figure .canvas
1363
1365
self .connect_default_events ()
@@ -1572,6 +1574,8 @@ def __init__(self, ax, onselect, drawtype='box',
1572
1574
lineprops = dict (color = 'black' , linestyle = '-' ,
1573
1575
linewidth = 2 , alpha = 0.5 )
1574
1576
self .lineprops = lineprops
1577
+ if useblit :
1578
+ self .lineprops ['animated' ] = True
1575
1579
self .to_draw = Line2D ([0 , 0 ], [0 , 0 ], visible = False ,
1576
1580
** self .lineprops )
1577
1581
self .ax .add_line (self .to_draw )
@@ -1705,6 +1709,8 @@ def __init__(self, ax, onselect=None, useblit=True, lineprops=None,
1705
1709
1706
1710
if lineprops is None :
1707
1711
lineprops = dict ()
1712
+ if useblit :
1713
+ lineprops ['animated' ] = True
1708
1714
self .line = Line2D ([], [], ** lineprops )
1709
1715
self .line .set_visible (False )
1710
1716
self .ax .add_line (self .line )
0 commit comments