Revision: 5877
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5877&view=rev
Author:   pkienzle
Date:     2008-07-25 21:32:06 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
update axis contains method for new transforms

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/axis.py

Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py     2008-07-25 19:52:11 UTC (rev 
5876)
+++ trunk/matplotlib/lib/matplotlib/axis.py     2008-07-25 21:32:06 UTC (rev 
5877)
@@ -1144,13 +1144,17 @@
         """
         if callable(self._contains): return self._contains(self,mouseevent)
 
-        xpixel,ypixel = mouseevent.x,mouseevent.y
+        x,y = mouseevent.x,mouseevent.y
         try:
-            xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
-            xorigin,yorigin = self.axes.transAxes.xy_tup((0,0))
+            trans = self.axes.transAxes.inverted()
+            xaxes,yaxes = trans.transform_point((x,y))
         except ValueError:
             return False, {}
-        inaxis = xaxes>=0 and xaxes<=1 and ypixel<yorigin and 
ypixel>yorigin-self.pickradius
+        l,b = self.axes.transAxes.transform_point((0,0))
+        r,t = self.axes.transAxes.transform_point((1,1))
+        inaxis = xaxes>=0 and xaxes<=1 and (
+                   (y<b and y>b-self.pickradius) or
+                   (y>t and y<t+self.pickradius))
         return inaxis, {}
 
     def _get_tick(self, major):
@@ -1376,13 +1380,17 @@
         """
         if callable(self._contains): return self._contains(self,mouseevent)
 
-        xpixel,ypixel = mouseevent.x,mouseevent.y
+        x,y = mouseevent.x,mouseevent.y
         try:
-            xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
-            xorigin,yorigin = self.axes.transAxes.xy_tup((0,0))
+            trans = self.axes.transAxes.inverted()
+            xaxes,yaxes = trans.transform_point((x,y))
         except ValueError:
             return False, {}
-        inaxis = yaxes>=0 and yaxes<=1 and xpixel<xorigin and 
xpixel>xorigin-self.pickradius
+        l,b = self.axes.transAxes.transform_point((0,0))
+        r,t = self.axes.transAxes.transform_point((1,1))
+        inaxis = yaxes>=0 and yaxes<=1 and (
+                   (x<l and x>l-self.pickradius) or
+                   (x>r and x<r+self.pickradius))
         return inaxis, {}
 
     def _get_tick(self, major):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to