Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.
(self, mouseevent)
| 269 | return d |
| 270 | |
| 271 | def contains(self, mouseevent): |
| 272 | """ |
| 273 | Return whether the mouse event occurred inside the axis-aligned |
| 274 | bounding-box of the text. |
| 275 | """ |
| 276 | if (self._different_canvas(mouseevent) or not self.get_visible() |
| 277 | or self._renderer is None): |
| 278 | return False, {} |
| 279 | # Explicitly use Text.get_window_extent(self) and not |
| 280 | # self.get_window_extent() so that Annotation.contains does not |
| 281 | # accidentally cover the entire annotation bounding box. |
| 282 | bbox = Text.get_window_extent(self) |
| 283 | inside = (bbox.x0 <= mouseevent.x <= bbox.x1 |
| 284 | and bbox.y0 <= mouseevent.y <= bbox.y1) |
| 285 | cattr = {} |
| 286 | # if the text has a surrounding patch, also check containment for it, |
| 287 | # and merge the results with the results for the text. |
| 288 | if self._bbox_patch: |
| 289 | patch_inside, patch_cattr = self._bbox_patch.contains(mouseevent) |
| 290 | inside = inside or patch_inside |
| 291 | cattr["bbox_patch"] = patch_cattr |
| 292 | return inside, cattr |
| 293 | |
| 294 | def _get_xy_display(self): |
| 295 | """ |