From: <pki...@us...> - 2008-07-25 23:22:28
|
Revision: 5878 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5878&view=rev Author: pkienzle Date: 2008-07-25 23:22:26 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Fix contains() for text and lines Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 21:32:06 UTC (rev 5877) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 23:22:26 UTC (rev 5878) @@ -2350,8 +2350,7 @@ """ if callable(self._contains): return self._contains(self,mouseevent) - inside = self.patch.contains(mouseevent.x, mouseevent.y) - return inside,{} + return self.patch.contains(mouseevent) def pick(self, *args): """ Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 21:32:06 UTC (rev 5877) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 23:22:26 UTC (rev 5878) @@ -236,10 +236,11 @@ if not is_numlike(self.pickradius): raise ValueError,"pick radius should be a distance" - # transform in backend + if self._invalid: + self.recache() if len(self._xy)==0: return False,{} - - xyt = self._transformed_path.get_fully_transformed_path().vertices + tpath, _ = self._transformed_path.get_transformed_path_and_affine() + xyt = tpath.vertices xt = xyt[:, 0] yt = xyt[:, 1] Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-07-25 21:32:06 UTC (rev 5877) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-07-25 23:22:26 UTC (rev 5878) @@ -135,6 +135,8 @@ """ if callable(self._contains): return self._contains(self,mouseevent) + if not self.get_visible() or self._renderer is None: + return False,{} l,b,w,h = self.get_window_extent().bounds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |