The picker draws on the shared popover, so it closes the way the popover does: the X,
Escape, and a press outside it.
- A press on the canvas closes it; presses in the panel beside it keep it, since a
swatch, a style chip or a field there switches the colour it edits.
- The control that opened it is held out of that closing and its rect is refreshed every
frame, so pressing the same swatch again reaches its own toggle — after the panel
scrolls too (the bug #730 had, in the picker's hands).
- Escape closes it before the binding deselects the layer, and not while one of its own
dropdowns is open.
Tests: a press on the canvas closes it, the same swatch closes it again (panel_remove_tests).
Clicking a colour swatch opens the picker; clicking the same one again closes
it (another swatch switches the picker to its paint). The page background, the
text range, the paint rows, the effect rows and the selection colours all
toggle.
The pickers' review fixes on top: the colour picker keeps its popover only
while it is open (a body that closed it left a stale dragged place for the next
picker to inherit); the style picker resets its retained popover when a new
picker opens and on its early-close paths; and Escape belongs to the nested
colour picker first, so closing it doesn't take the style picker down with it.
Opening the style picker, the layout settings or the stroke settings closes the
colour picker instead of leaving it lingering beside them.
`Popover` is the one card detached panels draw on: a header 40 points high
with the title 16 in from its left edge and a 24-point X 8 in from its right,
a hairline under it, the theme's popup shadow, and one slot. Its measurements
are our own — the colour picker's header, which it now uses — not another
product's.
The colour picker and the style picker move onto it in this commit; each keeps
only its own body. The style picker keeps its dark surface through
`Surface::Menu`, and its tools row (view, detach, create) now starts the slot,
under the shared title.
Closing is the widget's now: the X, Escape, and a press outside it — except in
the rects the caller holds out (the button that opened it, a popover it opened
in turn), so that button's own click can toggle it shut instead of the press
closing it and the release opening it again (the bug #730 has). The colour
picker keeps its old habit of staying open while the panel beside it is used.
Tests: press-and-release for the X, for a press on the opener (open) and for a
press elsewhere (closed), plus Escape, the opening rule, the lift and the drag.
The chrome detached panels share, in one place: a 240 pt card with a 40 pt header —
the title 16 in from its left edge, a 24 pt X 8 in from its right — a hairline under
the header and the theme's popup shadow, around one slot:
let mut p = Popover::new("my_popover", tr("Title"));
let closed = p.show(ctx, Open::Anchor(pos), Hold::default(), |ui| { /* the slot */ });
The measurements are the ones the colour picker's header already used, which this widget
now draws; the card is as wide as the picker was. The shadow is the theme's
(`visuals.popup_shadow`), so the dark theme gets its own.
Closing is the widget's: the X, Escape, and a press outside it — except in the rects the
caller holds out (`Hold { rects, escape }`: the button that opened it, a popover it opened
in turn), so that button's own click can toggle it shut instead of the press closing it
and the release opening it again (the bug the fill-rule panel has). Press-and-release
tests pin all of it.
It opens against an anchor (its right edge on the anchor, top on it, lifted when that
would run off the screen's bottom) or at a point; the header drags it.
Six headless tests: the header's geometry, the opening rule, the lift, the drag, the X,
Escape, and the press-and-release of a press on the opener (open) and elsewhere (closed).
Duplicate and Alt-drag copied a main component as a second main. Within
its file the copy is now an instance of it (components::copy_in_file,
shared by edit.duplicate and the Alt-drag copy), as Copy then Paste
already was. A variant duplicated in its set stays a new variant.
Layer data written with node.set {props: {pluginData}} was saved but no
command read it back. node.get (the command, the control method and MCP
get_node) and document.inspect now report pluginData as {key: value}
when a layer or page has any, so a tool keeping state in a file can
read it on its next run. Widget keys are included: the plugin rules
only stop plugins writing them, and widget.list already reports that
state.
Alt+arrows were left out of the nudge keys, so with Alt held to measure
the arrows did nothing and the distances never changed. The arrows now
nudge with Alt held too (Shift: the big step); the hover measurement is
recomputed every frame, so the labels follow each nudge. While measuring
to another layer the selection's handles and size label hide; both
layers keep their outlines.
The dim text token (disabled buttons, placeholders, hints) was 2.1:1 on
the light theme's panels; disabled buttons also faded to 40% opacity,
and selected text was drawn in the dark green, 1.4:1 on the dark
theme's selection highlight. The dim text token is now at least 3:1
against panels, fields and selected rows in both themes while staying
dimmer than secondary text, a disabled button is grey with that text,
and selected text takes the theme's readable green. A test checks the
ratios with the colour contrast helper.
The browser has no system fonts, and since releases moved to the shared
workflow the web build was made without craft-fonts: no font list and no
text drawn. The Georgian change also re-pinned craft-fonts to its main,
which has no fonts/latin-manifest.txt, so the next release would fail
under CRAFT_FONTS_REQUIRED. Pin the Latin commit again until one commit
has both (craft-fonts#42); desktop Georgian uses an installed font.