File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 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):
12421242 if self .eventpress == None :
12431243 return event .inaxes != self .ax
12441244
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+
12451260 # If a button was pressed, check if the release-button is the
12461261 # same.
12471262 return (event .inaxes != self .ax or
You can’t perform that action at this time.
0 commit comments