From 36ace0c563cc01a6cdbef58d199cbcca3b52dba4 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Sun, 8 Feb 2026 05:01:07 +0300 Subject: [PATCH] Fix offset tick labels: wrap indices with modulo, show LED 0 position Co-Authored-By: Claude Opus 4.6 --- server/src/wled_controller/static/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/src/wled_controller/static/app.js b/server/src/wled_controller/static/app.js index 72e41b4..f16d601 100644 --- a/server/src/wled_controller/static/app.js +++ b/server/src/wled_controller/static/app.js @@ -1197,6 +1197,8 @@ function renderCalibrationCanvas() { const segments = buildSegments(calibration); if (segments.length === 0) return; + const totalLeds = calibration.leds_top + calibration.leds_right + calibration.leds_bottom + calibration.leds_left; + // Edge bar geometry (matches CSS: corner zones 56px × 36px fixed) const cw = 56; const ch = 36; @@ -1233,11 +1235,17 @@ function renderCalibrationCanvas() { const count = seg.led_count; if (count === 0) return; - // Show only first and last LED index per edge + // Show only first and last LED index per edge, plus LED 0 if offset > 0 const labelsToShow = new Set(); labelsToShow.add(0); if (count > 1) labelsToShow.add(count - 1); + // Add LED 0 tick on the edge where it wraps + if (offset > 0 && totalLeds > 0) { + const zeroPos = (totalLeds - seg.led_start % totalLeds) % totalLeds; + if (zeroPos < count) labelsToShow.add(zeroPos); + } + // Tick styling const tickLen = 5; ctx.strokeStyle = 'rgba(255, 255, 255, 0.4)'; @@ -1248,7 +1256,7 @@ function renderCalibrationCanvas() { labelsToShow.forEach(i => { const fraction = count > 1 ? i / (count - 1) : 0.5; const displayFraction = seg.reverse ? (1 - fraction) : fraction; - const ledIndex = seg.led_start + i; + const ledIndex = totalLeds > 0 ? (seg.led_start + i) % totalLeds : seg.led_start + i; if (geo.horizontal) { const tx = geo.x1 + displayFraction * (geo.x2 - geo.x1);