Skip to content

frontend: line every centred element up on the window's centre - #19

Merged
valentinps merged 1 commit into
experimentalfrom
frontend-redesign
Aug 2, 2026
Merged

frontend: line every centred element up on the window's centre#19
valentinps merged 1 commit into
experimentalfrom
frontend-redesign

Conversation

@valentinps

Copy link
Copy Markdown
Owner

The active-filter banner sat visibly right of the search field above it. Auditing every centred element across ten widths and four dock states turned up two independent causes.

The map's overlay layer (hints, selection bar, filter banner) insetted by each dock separately, so it centred on the VISIBLE map rather than the window -- 109px out from the search field with just the layers dock open, and worse with a tool dock. Insetting symmetrically fixed the centre but then squeezed the layer narrower than a wide bar, at which point the auto margins collapsed and it drifted again. The layer now spans the full window exactly like #map and never changes size, so its centre is the window's centre unconditionally. A bar wider than the gap between the docks runs under one; the docks paint above it, so it is clipped rather than overlapping, and at any normal width there is room to spare.

The editor toolbar was separately a quarter of the window out, from a leftover alignToolbar() that measured the search box and wrote an inline left in VIEWPORT coordinates. That was correct when the top bar was a row of floating islands over a full-window map; once the toolbar moved into an insetted overlay layer its containing block was no longer the viewport, so the value was wrong by exactly the layer's offset. CSS centring does the job now, so the function is gone.

While in here: overlay children are centred by grid justify-self rather than left: 50% + a translate -- no percentage to resolve, and it lands on whole pixels so the text stays crisp. And the app bar's pill labels now drop at 1150px rather than 980px: the bar centres its search field by giving both side clusters an equal share of the leftover space, which only holds while each side's content fits its share, and with labels the right-hand cluster stopped fitting at about 1150.

ui_behaviour.py gains a check that every centred element agrees with the window centre across dock states, plus one for the altitude rail's 4px track. Verified over 40 width/dock combinations.

The active-filter banner sat visibly right of the search field above it.
Auditing every centred element across ten widths and four dock states
turned up two independent causes.

The map's overlay layer (hints, selection bar, filter banner) insetted by
each dock separately, so it centred on the VISIBLE map rather than the
window -- 109px out from the search field with just the layers dock open,
and worse with a tool dock. Insetting symmetrically fixed the centre but
then squeezed the layer narrower than a wide bar, at which point the auto
margins collapsed and it drifted again. The layer now spans the full
window exactly like #map and never changes size, so its centre is the
window's centre unconditionally. A bar wider than the gap between the
docks runs under one; the docks paint above it, so it is clipped rather
than overlapping, and at any normal width there is room to spare.

The editor toolbar was separately a quarter of the window out, from a
leftover alignToolbar() that measured the search box and wrote an inline
`left` in VIEWPORT coordinates. That was correct when the top bar was a
row of floating islands over a full-window map; once the toolbar moved
into an insetted overlay layer its containing block was no longer the
viewport, so the value was wrong by exactly the layer's offset. CSS
centring does the job now, so the function is gone.

While in here: overlay children are centred by grid `justify-self` rather
than `left: 50%` + a translate -- no percentage to resolve, and it lands
on whole pixels so the text stays crisp. And the app bar's pill labels
now drop at 1150px rather than 980px: the bar centres its search field by
giving both side clusters an equal share of the leftover space, which
only holds while each side's content fits its share, and with labels the
right-hand cluster stopped fitting at about 1150.

ui_behaviour.py gains a check that every centred element agrees with the
window centre across dock states, plus one for the altitude rail's 4px
track. Verified over 40 width/dock combinations.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@valentinps
valentinps merged commit 3ee54e0 into experimental Aug 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant