Module pointer_replay
Expand description
A still pointer over a rebuilt tree.
Controls learn that the pointer is over them from its moves. A rebuild (a worker result, a model refresh) or a relayout can put a fresh or moved control under a pointer that has not moved since, and that control never saw it arrive: a press there would be lost, and a release after a rebuild that happened while the button was held would reach a control that never saw the press.
Every host keeps one PointerReplay. It remembers where the pointer
last moved and is marked unsettled whenever the widgets were rebuilt or
moved. Before the next button press or release it hands back the last
position as a CursorMoved, which the host dispatches first, so hover
follows the pointer and a control that moved out from under it is no
longer hovered.
The release half needs the press too. Every shared control that runs on
a completed click (a button, a row, a disclosure, a copy action) keeps
its press in a [HeldPress], which records what the control was when it
took the press: a key naming it and where it was. A fresh control with
the same key at the same place accepts the release that ends that press.
The host forgets the press before every press and after every release
(PointerReplay::end_press), whichever widget it reached.
Structs§
- Pointer
Replay - The pointer’s last position over one surface, and whether the widgets changed under it since.