On Thursday, January 5, 2012, Arnaud Gardelein <arn...@oscopy.org> wrote:
> In my configuration, when button is released out of the axes,
> RectangleSelector does not catch the release-button event. The rectangle
> patch is then left on the Axe. I found more convenient for my
> application (oscopy, see oscopy.org) to catch the event even if out of
> axes and limit to the boundaries of the axes. Maybe this can be of any
> use to somebody else.
>
> *** widgets.py  2012-01-05 07:03:23.723656417 +0100
> --- widgets2.py 2012-01-05 07:04:29.351981851 +0100
> ***************
> *** 1242,1247 ****
> --- 1242,1262 ----
>              return event.inaxes!= self.ax
>
>          # If a button was pressed, check if the release-button is the
> +         # same. If event is out of axis, limit the data coordinates to
> axes
> +         # boundaries.
> +         if event.button == self.eventpress.button and event.inaxes !=
> self.ax:
> +             (xdata, ydata) =
> self.ax.transData.inverted().transform_point((event.x, event.y))
> +             xlim = self.ax.get_xlim()
> +             ylim = self.ax.get_ylim()
> +             if xdata < xlim[0]: xdata = xlim[0]
> +             if xdata > xlim[1]: xdata = xlim[1]
> +             if ydata < ylim[0]: ydata = ylim[0]
> +             if ydata > ylim[1]: ydata = ylim[1]
> +             event.xdata = xdata
> +             event.ydata = ydata
> +             return False
> +
> +         # If a button was pressed, check if the release-button is the
>          # same.
>          return  (event.inaxes!=self.ax or
>                   event.button != self.eventpress.button)
>
> Arnaud.
>
>

I don't have an opinion on this yet, but I do want to note that if this
change were applied, then the lasso selector should probably also be
changed in order to be consistent.

Ben Root
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to