fix(input): refuse non-finite region bounds, keep narrow regions movable, republish hot handles

This commit is contained in:
Martino Ferrari committed 2026-09-28 14:08:11 +02:00
1 parent 4681d7015b
commit 7cc06f07f5
7 files changed
+263 -19

No files matched your search

+11
View File
@@ -161,6 +161,12 @@ class Plot {
/// onto the sample grid as it is added -- exactly as `add_cursor()` places a
/// snapping cursor -- so a region handed to a plot that already holds samples is on
/// the grid from its first frame.
///
/// A region whose bounds are not both finite is *refused*: nothing is added, and the
/// returned id names no region (`region()` reads a default for it and `region_count()`
/// does not count it). Storing one would be worse than useless, because a `Free` region
/// holding a bound that is not a number could never be dragged back -- every motion
/// re-derives both bounds from the stored ones.
u32 add_region(const Region& region);
// --- accessors --------------------------------------------------------
@@ -340,6 +346,11 @@ class Plot {
/// bounds under the pointer and put them on the sample grid once, on release,
/// instead of both ends sticking as the pointer moves. Also drops the region's
/// cached statistics.
///
/// A pair of bounds that is not both finite is *refused*: `std::min`/`std::max` would
/// propagate a NaN through both stored bounds and a finite partner would be lost with
/// it, so a rejected call changes nothing at all -- the interval stays as it was, and
/// so do the statistics cached for it.
void set_region(u32 id, f64 x0, f64 x1);
/// Pulls a snapping region's bounds onto the sample grid: onto the nearest sample