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:
1 parent
1fc97d818f
commit
be1f31a04f
14 files changed
+276
-1
No files matched your search
@@ -229,6 +229,18 @@ class Controller {
|
||||
DragMode drag_mode() const noexcept { return mode_; }
|
||||
/// The current box-zoom selection in pixels; meaningful while BoxZoom.
|
||||
Rect selection_rect() const noexcept { return selection_; }
|
||||
|
||||
/// The rectangle a host should *draw* for the open box zoom: the swept area, widened to the full
|
||||
/// axes along whichever axis the modifier's mask will not zoom. Ctrl frames the x range only, so its
|
||||
/// preview is the band that spans the plot -- which is what the release will zoom -- where the area
|
||||
/// a purely horizontal drag sweeps is a sliver a few pixels tall. Shift (and any other combo) frames
|
||||
/// both, and gets the swept box itself.
|
||||
///
|
||||
/// Meaningful while `BoxZoom`, like `selection_rect()`; the zero rect otherwise.
|
||||
///
|
||||
/// Defined in the implementation: widening the preview to the axes needs the plot's layout, and
|
||||
/// `Plot` is only forward-declared here.
|
||||
Rect selection_preview() const noexcept;
|
||||
/// The cursor under the pointer -- a vertical marker or a horizontal ruler, whichever
|
||||
/// line the pointer is nearer -- or `kInvalid` when the pointer is outside the plot area
|
||||
/// or no cursor is within a few pixels.
|
||||
|
||||
Reference in new issue
Block a user