From 9abdc33713f3084396f47b7107f01ecb11180398 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 17 May 2026 05:34:06 +0200 Subject: [PATCH] fix(calc-02): update stack labels for navigation and move modes --- samples/calc-02/index.css | 5 +---- samples/calc-02/index.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/samples/calc-02/index.css b/samples/calc-02/index.css index bb7e7aa..964227e 100644 --- a/samples/calc-02/index.css +++ b/samples/calc-02/index.css @@ -123,10 +123,7 @@ body { padding-block: 0; } -.stack-label { - text-align: right; - opacity: 0.78; -} +/* removed extra first-column styling */ .stack-value { min-height: 0; diff --git a/samples/calc-02/index.js b/samples/calc-02/index.js index c8935af..3c04f51 100644 --- a/samples/calc-02/index.js +++ b/samples/calc-02/index.js @@ -137,9 +137,9 @@ function getStackDisplayValue(label) { } function getVisibleStackLabel(label) { - if (stackMode === 'navigation') { + if (stackMode === 'navigation' || stackMode === 'move') { const indexMap = { X: 0, Y: 1, Z: 2, T: 3 }; - return String(stackSelection + indexMap[label]); + return String(indexMap[label]); } return label; } @@ -147,7 +147,12 @@ function getVisibleStackLabel(label) { function updateStackLabels() { const stackLabels = ['T', 'Z', 'Y', 'X']; for (const label of stackLabels) { - stackEls[label].dataset.label = getVisibleStackLabel(label); + const stackCell = stackEls[label].parentElement; + if (!stackCell) continue; + const labelEl = stackCell.querySelector('.stack-label'); + if (labelEl) { + labelEl.textContent = `${getVisibleStackLabel(label)}:`; + } } } @@ -193,10 +198,6 @@ function render() { modeButton.textContent = calc.angleMode; } -function stackModeToLabel(index) { - return ['X', 'Y', 'Z', 'T'][Math.max(0, Math.min(3, index))] ?? 'X'; -} - function stopEditing(clearValue = false) { if (clearValue) { calc.inputValue = '';