From 1aac0495e1c7ef5d2c20b8894161fcf00a13d81d Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 12 Jul 2026 16:59:57 +0200 Subject: [PATCH] frontend: guard the TIFF value colour span against zero/negative `span = hi - lo || 1` only replaced an exactly-zero span, so Min>Max (or a cleared Min/Max field coercing to 0 via Number("")) gave a negative span and rendered the pedestal image with an inverted/collapsed colour scale. Use `hi - lo > 0 ? hi - lo : 1` so a non-positive span falls back to 1. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/src/components/TiffImageViewer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/TiffImageViewer.tsx b/frontend/src/components/TiffImageViewer.tsx index 8160daee..e84b3af4 100644 --- a/frontend/src/components/TiffImageViewer.tsx +++ b/frontend/src/components/TiffImageViewer.tsx @@ -133,7 +133,7 @@ function TiffImageViewer({ url, variant, height = 460 }: MyProps) { if (variant === "value") { const stops = CMAPS[cmapName] ?? CMAPS.Viridis; - const span = hi - lo || 1; + const span = hi - lo > 0 ? hi - lo : 1; // guard zero/negative (e.g. Min>Max or a cleared field) for (let i = 0; i < data.length; i++) { const v = data[i]; const j = i * 4;