diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d2a9f..c243f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ 🛠️ Bug fixes: +* When updating image parameters (`ImageParam`) from the associated item object: + * If `xmin`, `xmax`, `ymin`, `ymax` attributes are not yet set (i.e. `None`), do not update them with the image data bounds + * Previous behavior was to update them with the image data bounds, which was leading to breaking the automatic bounds update when the image data is updated * [Issue #24](https://github.com/PlotPyStack/PlotPy/issues/24) - Colormap: side effect on image axes when changing the colormap * [Issue #23](https://github.com/PlotPyStack/PlotPy/issues/23) - Windows: Image `_scaler` engine performance regression * PySide6 compatibility issues: diff --git a/plotpy/styles/image.py b/plotpy/styles/image.py index 8f98be4..2a196ef 100644 --- a/plotpy/styles/image.py +++ b/plotpy/styles/image.py @@ -350,12 +350,12 @@ class ImageParam(RawImageParam): help=_("Locked images are not movable with the mouse"), ) _xdata = BeginGroup(_("Image placement along X-axis")) - xmin = FloatItem(_("x|min"), default=None) - xmax = FloatItem(_("x|max"), default=None) + xmin = FloatItem(_("x|min"), default=None, check=False) + xmax = FloatItem(_("x|max"), default=None, check=False) _end_xdata = EndGroup(_("Image placement along X-axis")) _ydata = BeginGroup(_("Image placement along Y-axis")) - ymin = FloatItem(_("y|min"), default=None) - ymax = FloatItem(_("y|max"), default=None) + ymin = FloatItem(_("y|min"), default=None, check=False) + ymax = FloatItem(_("y|max"), default=None, check=False) _end_ydata = EndGroup(_("Image placement along Y-axis")) def update_param(self, item: ImageItem) -> None: @@ -366,21 +366,9 @@ def update_param(self, item: ImageItem) -> None: """ super().update_param(item) self.xmin = item.xmin - if self.xmin is None: - self.xmin = 0.0 self.ymin = item.ymin - if self.ymin is None: - self.ymin = 0.0 - if item.is_empty(): - shape = (0, 0) - else: - shape = item.data.shape self.xmax = item.xmax - if self.xmax is None: - self.xmax = float(shape[1]) self.ymax = item.ymax - if self.ymax is None: - self.ymax = float(shape[0]) def update_item(self, item: ImageItem) -> None: """Update the given image item from the parameters.