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) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 16:59:57 +02:00
co-authored by Claude Opus 4.8
parent d033b378ae
commit 1aac0495e1
+1 -1
View File
@@ -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;