|
16 | 16 | from plotpy import io |
17 | 17 | from plotpy.config import _ |
18 | 18 | from plotpy.constants import ID_CONTRAST, PlotType |
| 19 | +from plotpy.coords import axes_to_canvas |
19 | 20 | from plotpy.events import QtDragHandler, setup_standard_tool_filter |
20 | 21 | from plotpy.interfaces import ( |
21 | 22 | IColormapImageItemType, |
@@ -114,13 +115,10 @@ def get_infos(self) -> str | None: |
114 | 115 | plot = self.image_item.plot() |
115 | 116 | if plot is None: |
116 | 117 | return None |
117 | | - p0y = plot.transform(0, self.shape.get_points()[0][1]) |
118 | | - p0x = plot.transform(2, self.shape.get_points()[0][0]) |
119 | | - p1y = plot.transform(0, self.shape.get_points()[1][1]) |
120 | | - p1x = plot.transform(2, self.shape.get_points()[1][0]) |
121 | | - p0 = QC.QPointF(p0x, p0y) |
122 | | - p1 = QC.QPointF(p1x, p1y) |
123 | | - items = get_items_in_rectangle(plot, p0, p1) |
| 118 | + x0, y0, x1, y1 = self.shape.get_rect() |
| 119 | + p0x, p0y = axes_to_canvas(self, x0, y0) |
| 120 | + p1x, p1y = axes_to_canvas(self, x1, y1) |
| 121 | + items = get_items_in_rectangle(plot, QC.QPointF(p0x, p0y), QC.QPointF(p1x, p1y)) |
124 | 122 | if len(items) >= 1: |
125 | 123 | sorted_items = [ |
126 | 124 | it for it in sorted(items, key=lambda obj: obj.z()) if it.isVisible() |
|
0 commit comments