Permalink
Browse files

Merge pull request #1088 from dhyams/text_contains_based_on_master

For a text artist, if it has a _bbox_patch associated with it, the contains test should reflect this.
  • Loading branch information...
2 parents 0b64cc1 + 834f4cb commit 963506fae323350043d5688379c93870e39f3a24 @WeatherGod WeatherGod committed Aug 20, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/matplotlib/text.py
View
11 lib/matplotlib/text.py
@@ -211,7 +211,16 @@ def contains(self,mouseevent):
x, y = mouseevent.x, mouseevent.y
inside = (l <= x <= r and b <= y <= t)
- return inside, {}
+ cattr = {}
+
+ # if the text has a surrounding patch, also check containment for it,
+ # and merge the results with the results for the text.
+ if self._bbox_patch:
+ patch_inside, patch_cattr = self._bbox_patch.contains(mouseevent)
+ inside = inside or patch_inside
+ cattr["bbox_patch"] = patch_cattr
+
+ return inside, cattr
def _get_xy_display(self):
'get the (possibly unit converted) transformed x, y in display coords'

0 comments on commit 963506f

Please sign in to comment.