feat: an open box zoom draws the frame the release will apply

The controller has always tracked its selection; nothing drew it, so a Ctrl or
Shift drag framed a range with no feedback until the release.

The preview is the area the release will change, not what the pointer swept:
Ctrl frames the x range only, so a band across the plot is what it will zoom,
where the sliver a straight horizontal drag sweeps is only the gesture. The
plot carries the rect a host hands it -- it learns nothing about pointers --
and the renderer draws a low-alpha fill under a light border over everything
else inside the axes.
This commit is contained in:
Martino Ferrari committed 2026-10-11 11:07:55 +02:00
1 parent 1fc97d818f
commit be1f31a04f
14 files changed
+276 -1

No files matched your search

+10
View File
@@ -192,6 +192,16 @@ without knowing what a pointer is. `hovered_cursor()`, `grabbed_cursor()`, `hove
`grabbed_region()` and `region_grab(u32)` expose the same answers to a host (a resize cursor, a
tooltip, a status line).
The frame an open box zoom is drawing is published the same way and for the same reason
(`Plot::set_selection_rect()`), and the plot still learns nothing about pointers: the host reads the
rect off the controller -- `Controller::selection_preview()` -- on every frame of the drag and takes it
off the plot when the gesture ends. The preview is deliberately not what the pointer swept. Shift
frames both axes and its preview is the swept box; Ctrl frames x only, so its preview is widened to the
full height of the axes, and Alt's to the full width. The swept sliver is the *gesture*; the widened
rect is what the *release* will apply, which is the one worth showing while it is still only a
gesture. Nothing is previewed until the drag has swept every axis the release will act on: an empty
rect widened is a band the width of the plot, which would claim a range that does not exist yet.
## Live follow
An x axis has a follow state, `XFollow::Off` (the default) or `XFollow::Live`