From 6312bf7a00b3b7e2123cae758d71a60c7102866f Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Sep 2026 04:50:19 +0200 Subject: [PATCH] fix: Tidy says Tidy, and takes the shake out when pressed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was a bare ⌁, 30px square, wedged between the kind and the remove cross in a 360px panel — which also squeezed the label box down to four characters. Nobody could be expected to recognise it, and the answer to "where is Tidy" was "you are looking at it". The row is two lines now: the shape and its two buttons, then the label across the full width, and the button says Tidy. And pressing it does something. smoothOut ran Ramer–Douglas–Peucker and stopped: simplification drops the points that carry no shape, but it never moves the ones it keeps, so a stroke that wandered by more than epsilon came back wandering by exactly as much. A relaxing pass follows it now — a moving average over the interior, twice — so the shake goes and the route stays. The two ends never move: where somebody put the pen down and lifted it is the deliberate part of a freehand mark. Still offered rather than applied, per shape and undoable. A traced anatomical edge is meant to wander. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN --- frontend/src/components/OverlayEditor.css | 15 ++++++---- frontend/src/components/OverlayEditor.jsx | 34 +++++++++++++++-------- frontend/src/utils/tidyShape.js | 28 ++++++++++++++++++- frontend/src/utils/tidyShape.test.js | 15 ++++++++++ 4 files changed, 73 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/OverlayEditor.css b/frontend/src/components/OverlayEditor.css index 9dc4f96..f18e637 100644 --- a/frontend/src/components/OverlayEditor.css +++ b/frontend/src/components/OverlayEditor.css @@ -77,14 +77,15 @@ .ovl-empty { margin: 0; color: #9aa3b2; line-height: 1.45; } .ovl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; } .ovl-list li { - display: flex; align-items: center; gap: 8px; - padding: 4px 4px 4px 10px; border: 1px solid #262c35; border-radius: 8px; + display: flex; flex-direction: column; gap: 6px; + padding: 6px; border: 1px solid #262c35; border-radius: 8px; } +.ovl-shape-row { display: flex; align-items: center; gap: 8px; } .ovl-list li.is-active { border-color: #5eead4; } .ovl-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; } -.ovl-kind { flex: none; min-width: 5.5em; } +.ovl-kind { flex: 1; min-width: 0; } .ovl-label { - flex: 1 1 60px; min-width: 0; min-height: 40px; padding: 0 8px; + width: 100%; box-sizing: border-box; min-height: 40px; padding: 0 8px; font: inherit; color: inherit; background: #0f1216; border: 1px solid #343b47; border-radius: 6px; } @@ -126,8 +127,10 @@ is meant to wander, and straightening one silently would correct the finding instead of the drawing. */ .ovl-tidy { - flex: none; width: 30px; height: 30px; padding: 0; cursor: pointer; + flex: none; display: inline-flex; align-items: center; gap: 5px; + height: 30px; padding: 0 10px; cursor: pointer; border: 1px solid #2c3444; border-radius: 8px; - background: transparent; color: #cbd5e1; font-size: 1rem; line-height: 1; + background: transparent; color: #cbd5e1; + font: inherit; font-size: .82rem; font-weight: 600; line-height: 1; } .ovl-tidy:hover { border-color: #5eead4; color: #5eead4; } diff --git a/frontend/src/components/OverlayEditor.jsx b/frontend/src/components/OverlayEditor.jsx index 7cf2da2..724d2bf 100644 --- a/frontend/src/components/OverlayEditor.jsx +++ b/frontend/src/components/OverlayEditor.jsx @@ -397,8 +397,28 @@ export default function OverlayEditor({ src, overlay, onSave, onClose }) { onFocus={() => setActiveId(s.id)} onBlur={() => setActiveId(null)} > -