MenuHelp had two constructors, one over a list the caller built every
frame and one over a function the bar calls only while the Help menu is
open. Only the second keeps closed menus from paying for the list, so it
is the one constructor: MenuHelp::new takes the function.
A menu row's highlight comes from the LEAD flag rule, which resolves without easing, and
the popup makes the row under the pointer active before its rows run. The new test pins
both: the frame that moves the pointer onto the next row paints that row's full highlight
and none on the row it left, with no time passing. It fails if the active row follows the
pointer a frame late, or if the highlight moves onto the eased hover mix (80 ms).
Fixture::frame_shapes_with(events) returns what the frame that took the input painted.
Part of photocraft#15477.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-window menu bar, its Alt, F10 and letter keys, and Ctrl moving only a list's lead are PC behaviour. The fixtures took the host's OS, so the tests failed on macOS runners.
Every row of a menu level asks for its letter in every pass, and
`MenuLevel::mnemonic_of` assigned the letters of all the level's rows for
each of them; `end` did once more. A long menu (PhotoCraft's Filter menu,
about twenty rows) and each submenu it opened paid that many full
assignments per frame: in a profile of hovering the Filter menu's submenu
rows, `mnemonic::assign` was about 6 % of the open menus' cost, and the
frame that opens a submenu reached 12.7 ms of UI work.
The level keeps the last assignment with the labels and folder it was made
for and assigns again only when they change. `mnemonic_of` reads its entry
with `get`, so a row that is not in the list gets none instead of an
index out of range.
Part of storytold/photocraft#15493.
Two costs every frame paid, found in a profile of PhotoCraft on the
framework (storytold/photocraft#15493):
- `MenuBarUi::show` collected the Help search's entries (every row of
every menu, with English labels) on every pass whenever the bar had a
Help menu, open or not. `MenuHelp::built` takes a builder the bar runs
only in a pass that shows the Help menu; `MenuHelp::new` keeps taking a
ready list.
- `Keymap::shown_chord`, which every menu row, tooltip and button asks
each pass, built the command's key string for every `find` and ran a
full `lookup` per binding, cloning the winning commands only to look
their keys up again. `find` now looks up a command without parameters
by its id, and `press_runs` decides on catalog positions. Answers are
unchanged; a new test covers tools sharing a chord (a cycle within a
group, the first of two groups), which no test covered.
Measured in PhotoCraft (Windows 11, idle machine, three runs, together
with PhotoCraft's own storytold/photocraft#15496): UI pass with a pointer
over the canvas 8.7-11.3 ms -> 4.9-5.0 ms, during a menu hover
9.2-10.2 ms -> 6.7-7.1 ms.
Part of storytold/photocraft#15493.
egui's fade asked for a repaint every frame until its age passed the animation time, a second open
fade beside the presence tween; with the clock still (a trial's frames) it never ended. The menu row
trial counts egui's two frames after input before asserting that the menu asks for none.
The pass that moves the pointer onto a row paints that row lit and the row it left unlit, with no
follow-up pass. Rows no longer activate themselves on hover; runtime::pointer::hovers reads the
pass's one resolution for a component. MenuItemOutput reports whether the row is active. Trial:
a pointer move over the rows of a scrolling menu, at 1x and 1.5x, down and up.
The apply step counted a write only for Update and Commit, so a Set (cx.set,
or a gesture that begins and commits in one pass) changed the bound place
without noting the edit: no settled region or hidden page that read the value
measured again, and no earlier reader got the edit rerun. A given binding's
Set likewise unsettled nothing. Set now carries its value in both tests.
The Pages edit trial asserts one measuring run of the hidden page in the edit
frame. The popover click trial counts the row's activations: a leaf counts a
press in every pass with a press phase, so a click that lands counts more than
one. It clicks the new page's row right after the switch frame's idle frame.
A hidden page is measured only: a measuring run inside an invisible sizing
child, so it senses, registers and paints nothing. It reuses the size its
last measuring run found while nothing it read changed, under the settled
rules a measure reads (no input other than pointer motion, no edit of a value
it read, nothing moving, no app repaint): the measuring run opens the same
run record replay::open/close keeps for settling regions, and lazy keeps its
facts with the size. A reused page notes its reads again, so an edit of one
later in the pass reruns the pass.
PaintChip shows its paint kinds through Pages: its popover keeps the size of
its largest page, so a tab switch moves and resizes nothing.