commit 3bf1d052a7c6028c5af0bd762c1e377f15e336bd parent b80a92005534b902ebbcac93958ee88b7eaf54c2 Author: Hunter Date: Tue, 21 Oct 2025 17:52:29 -0400 fade out dimension labels for values < 5 Diffstat:
| M | script.js | | | 16 | ++++++++++++++-- |
| M | style.css | | | 4 | ++++ |
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/script.js b/script.js @@ -251,8 +251,20 @@ function updateImagePosition(img) { // Update dimension labels const widthLabel = img.container.querySelector('.dimension-label.width'); const heightLabel = img.container.querySelector('.dimension-label.height'); - if (widthLabel) widthLabel.textContent = img.widthCells; - if (heightLabel) heightLabel.textContent = img.heightCells; + if (widthLabel) { + // Only update text if dimension is >= 5 + if (img.widthCells >= 5) { + widthLabel.textContent = img.widthCells; + } + widthLabel.dataset.hidden = img.widthCells < 5 ? 'true' : 'false'; + } + if (heightLabel) { + // Only update text if dimension is >= 5 + if (img.heightCells >= 5) { + heightLabel.textContent = img.heightCells; + } + heightLabel.dataset.hidden = img.heightCells < 5 ? 'true' : 'false'; + } // Recalculate baseScale if container size changed if (img.naturalWidth > 0 && img.naturalHeight > 0) { diff --git a/style.css b/style.css @@ -278,6 +278,10 @@ body.dragging * { opacity: 1; } +.dimension-label[data-hidden="true"] { + opacity: 0 !important; +} + .resize-handle.corner { width: 10px; height: 10px;