From: Egor Z. <ez...@gm...> - 2008-11-26 17:41:56
|
John Hunter wrote: > On Wed, Nov 26, 2008 at 10:41 AM, Drain, Theodore R > <the...@jp...> wrote: > > >> I'm pretty sure this is exactly what's happening. This is also >> annoying when you're trying to use a zoom rectangle and want to start >> at some point in the plot and drag it to the boundary. We've been >> planning on putting some time in to fix this this but just haven't >> been able to make the time yet. >> >> I think one possible solution is that anytime the mouse moves outside >> the axes, it should get one last event that is at the boundary which >> would require tracking which axes the last event was sent in. We >> haven't tried to see how hard that is to implement thought... >> > > probably fairly easy using a class level attr in the MouseEvent. > Another possibility would be to add support for figure_enter_event, > figure_leave_event, axes_enter_event, axes_leave_event. The user code > would have to separately process the axes_leave_event but this might > be the cleanest solution. I am happy to add support for these ... > John, in my code, I implemented tests like: if self.valmin is not None: if val < self.valmin: val = self.valmin which makes limit handling better than that of the Slider class this was based on: if self.slidermin is not None: if val<=self.slidermin.val: return Theodore nailed what is happening. At the moment, tests like the one I used cannot be implemented because event.xdata returns None when outside the boundaries. This cannot be compared with ax.get_xlim(). Maybe a value should be returned even when outside. the event.inaxes should be enough to know if the mouse pointer is inside or outside. Although that would probably break a few things that at the moment depend on event.xdata being None when outside! |