Skip to content

Commit 38e3d95

Browse files
committed
Image parameters: do not override x/y bounds when undefined
(avoid interfering with automatic bound settings)
1 parent a37af8a commit 38e3d95

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
🛠️ Bug fixes:
66

7+
* When updating image parameters (`ImageParam`) from the associated item object:
8+
* If `xmin`, `xmax`, `ymin`, `ymax` attributes are not yet set (i.e. `None`), do not update them with the image data bounds
9+
* 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
710
* [Issue #24](https://github.com/PlotPyStack/PlotPy/issues/24) - Colormap: side effect on image axes when changing the colormap
811
* [Issue #23](https://github.com/PlotPyStack/PlotPy/issues/23) - Windows: Image `_scaler` engine performance regression
912
* PySide6 compatibility issues:

plotpy/styles/image.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ class ImageParam(RawImageParam):
350350
help=_("Locked images are not movable with the mouse"),
351351
)
352352
_xdata = BeginGroup(_("Image placement along X-axis"))
353-
xmin = FloatItem(_("x|min"), default=None)
354-
xmax = FloatItem(_("x|max"), default=None)
353+
xmin = FloatItem(_("x|min"), default=None, check=False)
354+
xmax = FloatItem(_("x|max"), default=None, check=False)
355355
_end_xdata = EndGroup(_("Image placement along X-axis"))
356356
_ydata = BeginGroup(_("Image placement along Y-axis"))
357-
ymin = FloatItem(_("y|min"), default=None)
358-
ymax = FloatItem(_("y|max"), default=None)
357+
ymin = FloatItem(_("y|min"), default=None, check=False)
358+
ymax = FloatItem(_("y|max"), default=None, check=False)
359359
_end_ydata = EndGroup(_("Image placement along Y-axis"))
360360

361361
def update_param(self, item: ImageItem) -> None:
@@ -366,21 +366,9 @@ def update_param(self, item: ImageItem) -> None:
366366
"""
367367
super().update_param(item)
368368
self.xmin = item.xmin
369-
if self.xmin is None:
370-
self.xmin = 0.0
371369
self.ymin = item.ymin
372-
if self.ymin is None:
373-
self.ymin = 0.0
374-
if item.is_empty():
375-
shape = (0, 0)
376-
else:
377-
shape = item.data.shape
378370
self.xmax = item.xmax
379-
if self.xmax is None:
380-
self.xmax = float(shape[1])
381371
self.ymax = item.ymax
382-
if self.ymax is None:
383-
self.ymax = float(shape[0])
384372

385373
def update_item(self, item: ImageItem) -> None:
386374
"""Update the given image item from the parameters.

0 commit comments

Comments
 (0)