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
@@ -306,6 +306,11 @@ u32 Plot::add_annotation(const Annotation& annotation) {
|
||||
return static_cast<u32>(annotations_.size() - 1);
|
||||
}
|
||||
|
||||
void Plot::set_annotation(u32 id, const Annotation& annotation) {
|
||||
if (id >= annotations_.size()) return;
|
||||
annotations_[id] = annotation;
|
||||
}
|
||||
|
||||
u32 Plot::add_region(const Region& region) {
|
||||
// A region whose bounds are not numbers is not an interval this plot can hold, and a
|
||||
// `Free` one stored that way could never be dragged back (every motion re-derives both
|
||||
|
||||
Reference in new issue
Block a user