fix: a fit undoes an x zoom instead of redefining the time window
The previous commit took "fit x sets the window properly" to mean a fit should frame the data and propagate that as the new time scale. It should not: a fit is a plot interaction, and the window is also the trigger's event span and how the samples are stored, so a fit that framed the data could re-plan the rings and drop the history on a menu click. What a fit means here is the undo of a zoom -- a 2 s window zoomed into reads 2 s again. `fit_x()` therefore reads `window_s_` and never writes it. Live it takes the window-control path with the window already set, which re-arms the follow and parks the newest span at the live edge. Pinned -- a held event, a filling capture or a paused view -- it restores the pin's full range, which is the snapshot's own span and may be narrower than the requested window, and it writes the per-row member axes as well as the link group: `hold_pinned_window()` prefers a member that differs from `pinned_stated_`, so writing the group alone is reverted to the zoomed range one frame later. `apply_window_scale()` is folded back into `apply_time_window()`, which the window control is again the only caller of. The probe now zooms in before fitting, since otherwise there is nothing to undo, and reports `pinned=`. `window` and `event_span` must be unchanged on every line. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9888fd9977
commit
3d7e214295
7 files changed
+193
-150
No files matched your search
+21
-17
@@ -298,17 +298,24 @@ class RowSet {
|
||||
void set_data_pin(double lo, double hi);
|
||||
void unpin_pause_window();
|
||||
|
||||
/// Frames the x window on the data row 0 holds, leaving every y axis alone. The x
|
||||
/// counterpart of `fit_all()`, for the one thing the y axes cannot say: how wide the
|
||||
/// window should be.
|
||||
/// Undoes an x zoom: puts the view back on the whole time window, leaving every y axis alone.
|
||||
/// The x counterpart of `fit_all()`.
|
||||
///
|
||||
/// Reports the span it framed in `span` and `true` when it framed one at all (row 0 may hold
|
||||
/// no data, and a degenerate range is refused). **The caller owes the rest of the time
|
||||
/// scale**: this moves the view and `window_s_`, and the trigger's event span, the buffer
|
||||
/// partition and the window control are the caller's to move with it -- see
|
||||
/// `apply_window_scale()` in `ui.cpp`. Leaving them behind is what made a fit and the control
|
||||
/// disagree about what the window was.
|
||||
bool fit_x(double& span);
|
||||
/// **It does not change the time window** -- `window_s_` is read, never written. A fit is a
|
||||
/// plot interaction, and the window is also the trigger's event span, the buffer partition and
|
||||
/// the control's readout, so a fit that *framed the data* instead would redefine all of that
|
||||
/// from a gesture (and re-plan the rings, dropping the history). What a user asks for here is
|
||||
/// the zoom undone: a 2 s window zoomed into reads 2 s again.
|
||||
///
|
||||
/// Which 2 s depends on the state, and both cases restore the *whole* of what the view is
|
||||
/// allowed to show: live, the newest window at the live edge; pinned (a held event or a paused
|
||||
/// view), the pin's full range, with the pin kept -- `set_time_window()` would clear it and
|
||||
/// re-frame on a live edge that a frozen view has nothing bound to.
|
||||
void fit_x();
|
||||
|
||||
/// Whether a window is pinned: a held event, a filling capture or a paused view. The condition
|
||||
/// `fit_x()` branches on, which is why the fit probe reports it.
|
||||
bool window_pinned() const noexcept { return pinned_; }
|
||||
|
||||
/// Adopts the instruments a gesture is moving, on `drag_row` (the row whose controller holds
|
||||
/// a cursor), and nothing otherwise.
|
||||
@@ -343,13 +350,10 @@ class RowSet {
|
||||
/// 0, so nothing outside the pre+post window is visible.
|
||||
void pin_event_window(double pre_s, double post_s);
|
||||
|
||||
/// Fits every row's y axis to the data it holds, and re-frames the shared x window
|
||||
/// on what row 0 retains (the same thing the plot's own `f` key does).
|
||||
///
|
||||
/// Reports the framed x span exactly as `fit_x()` does, and leaves the caller the same debt:
|
||||
/// the y fit is this object's business alone, but the x span is the *time scale*, and the
|
||||
/// trigger's event span, the buffer partition and the window control have to move with it.
|
||||
bool fit_all(double& span);
|
||||
/// Fits every row's y axis to the data it holds, and puts x back on the whole time window --
|
||||
/// `fit_x()`'s x half exactly, so the two cannot drift apart. Like it, **this does not change
|
||||
/// the time window**: the y axes are fitted to their data, x is merely un-zoomed.
|
||||
void fit_all();
|
||||
|
||||
/// Reports the left gutter the rows currently need, and reserves at least the width
|
||||
/// of the widest *plausible* y label.
|
||||
|
||||
Reference in new issue
Block a user