Trim needless comments and fix the picker width

Remove comments that only restate the code, keeping the section banners
and the notes that carry a reason, a measured fact or an external
contract.

ButtonOptions.width claimed to be a fixed width but only set minWidth,
so the Graph and Texture pickers grew with the name they showed. It is
now what it promises, with a separate minWidth for the buttons that have
two forms. Narrow buttons shrink their padding, otherwise a 24px icon
button had 8px left for its glyph and truncate dropped it entirely.

__gm.labelsDropped() guards that class: the overflow guard only saw text
that was too wide, never a label truncated to nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5 committed 2026-09-08 15:52:05 +02:00
1 parent f16801aef3
commit 4d84231b9f
115 files changed
+707 -1564

No files matched your search

+6 -9
View File
@@ -22,7 +22,6 @@ describe('sheet view mapping', () => {
const view = { panX: 100, panY: 50, zoom: 2 };
expect(imageToLocal(view, 0, 0)).toEqual({ x: 100, y: 50 });
expect(imageToLocal(view, 8, 4)).toEqual({ x: 116, y: 58 });
// Round trip: the two are inverses, which is what lets a drag be computed in either space.
expect(localToImage(view, 116, 58)).toEqual({ x: 8, y: 4 });
});
@@ -32,7 +31,7 @@ describe('sheet view mapping', () => {
expect(view.zoom).toBeCloseTo(3.6);
expect(view.panX).toBeCloseTo((400 - 100 * 3.6) / 2);
expect(view.panY).toBeCloseTo((400 - 50 * 3.6) / 2);
// The whole picture is inside the widget, which is the only thing "fit" has to guarantee.
// Fitting only has to guarantee that the whole picture is inside the widget.
const end = imageToLocal(view, 100, 50);
expect(view.panX).toBeGreaterThanOrEqual(0);
expect(end.x).toBeLessThanOrEqual(400);
@@ -77,8 +76,8 @@ describe('grabbing a frame', () => {
});
it('prefers a corner where handles overlap, so a tiny frame stays resizable', () => {
// A 4x4 frame with a 6 px tolerance: every handle matches the centre of the frame, and
// grabbing it must resize rather than move, or a small frame could never be adjusted.
// A 4x4 frame with a 6 px tolerance: every handle matches its centre, and a grab there
// must resize, or the frame could never be adjusted.
const tiny: FrameRect = { x: 0, y: 0, w: 4, h: 4 };
expect(handleAt(tiny, { x: 2, y: 2 }, 6)).toEqual({ hx: -1, hy: -1 });
});
@@ -98,7 +97,6 @@ describe('dragging a frame', () => {
});
it('pins the opposite edge when a corner is dragged', () => {
// Dragging the top-left corner right and down shrinks the frame; the bottom-right stays.
const dragged = dragFrame(RECT, { hx: -1, hy: -1 }, 4, 6);
expect(dragged).toEqual({ x: 14, y: 26, w: 36, h: 24 });
expect(dragged.x + dragged.w).toBe(RECT.x + RECT.w);
@@ -111,8 +109,8 @@ describe('dragging a frame', () => {
});
it('is allowed to invert – squaring that up belongs to one place only', () => {
// Pulling the left edge past the right one yields a negative width on purpose:
// `normalizeFrameRect` corrects it, so a drag and a typed value are corrected identically.
// The negative width is on purpose: `normalizeFrameRect` corrects a drag and a typed
// value identically.
const dragged = dragFrame(RECT, { hx: -1, hy: 0 }, 60, 0);
expect(dragged.w).toBeLessThan(0);
});
@@ -124,8 +122,7 @@ describe('dragging a frame', () => {
});
it('walks a frame through the eight handles back to where it started', () => {
// Each handle dragged by (d) and then by (−d) is the identity; a sign error in any one of
// the eight branches shows up here without needing eight separate expectations.
// A sign error in any of the eight branches breaks the drag-and-back identity.
const handles: FrameHandle[] = [
'move',
{ hx: -1, hy: -1 },