feat(plot): set_annotation(), so a readout annotation can be moved
A host whose annotation is a readout -- the point where a cursor crosses a trace -- has to move it every frame, and `add_annotation()` only appends: the id would change every frame and the annotation count grow without bound. The setter keeps the id, ignores a stale one exactly as the cursor setters do, and pairs with parking (`visible = false`) since there is no `remove_annotation`. Tested by `an_annotation_can_be_moved_by_id` in tests/test_plot.cpp.
This commit is contained in:
1 parent
e337c6a60c
commit
133cd680ce
3 files changed
+46
No files matched your search
@@ -229,6 +229,13 @@ class Plot {
|
||||
/// Measures the interval between two cursors over the series of `trace`.
|
||||
u32 add_measure(u32 cursor_a, u32 cursor_b, u32 trace = 0);
|
||||
u32 add_annotation(const Annotation& annotation);
|
||||
/// Moves an annotation that is already in the plot, keeping its id -- what a host whose
|
||||
/// annotation is a *readout* needs (the point where a cursor crosses a trace moves with
|
||||
/// the cursor). `Plot` has no `remove_annotation`, so the same parking discipline as the
|
||||
/// cursors applies: set `visible = false` rather than dropping it, and re-place where it
|
||||
/// belongs. An id that names no annotation is ignored, not an error, exactly as every
|
||||
/// other setter here treats a stale id.
|
||||
void set_annotation(u32 id, const Annotation& annotation);
|
||||
/// Adds a region. Its bounds are ordered and, when the region asks to snap, pulled
|
||||
/// 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
|
||||
|
||||
Reference in new issue
Block a user