File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1242,6 +1242,21 @@ def ignore(self, event):
1242
1242
if self .eventpress == None :
1243
1243
return event .inaxes != self .ax
1244
1244
1245
+ # If a button was pressed, check if the release-button is the
1246
+ # same. If event is out of axis, limit the data coordinates to axes
1247
+ # boundaries.
1248
+ if event .button == self .eventpress .button and event .inaxes != self .ax :
1249
+ (xdata , ydata ) = self .ax .transData .inverted ().transform_point ((event .x , event .y ))
1250
+ x0 , x1 = self .ax .get_xbound ()
1251
+ y0 , y1 = self .ax .get_ybound ()
1252
+ xdata = max (x0 , xdata )
1253
+ xdata = min (x1 , xdata )
1254
+ ydata = max (y0 , ydata )
1255
+ ydata = min (y1 , ydata )
1256
+ event .xdata = xdata
1257
+ event .ydata = ydata
1258
+ return False
1259
+
1245
1260
# If a button was pressed, check if the release-button is the
1246
1261
# same.
1247
1262
return (event .inaxes != self .ax or
You can’t perform that action at this time.
0 commit comments