feat(input): a cursor can be unselectable, for a host's readout marks
A host that draws the result of a computation as a cursor -- a ruler at a level it measured, a marker at a time it found -- must not let the user drag it: the value belongs to the measurement, not to the pointer. Parking it outside the axis and re-placing it every frame does not achieve that, because a drag is held for the gesture's life and the marker follows the pointer between frames, so the readout *looks* draggable however often it is put back. `Cursor::selectable` defaults true; the controller's hit test skips an unselectable cursor, so it is neither hovered nor grabbed and its hit radius goes to whatever is behind it. Set through `Plot::set_cursor_selectable()`. Tested by `an_unselectable_cursor_is_neither_hovered_nor_grabbed` in tests/test_controller.cpp.
This commit is contained in:
1 parent
125cc1f64a
commit
211c5b97bc
5 files changed
+50
-1
No files matched your search
@@ -311,6 +311,11 @@ void Plot::set_cursor_color(u32 id, Color color) {
|
||||
cursors_[id].color = color;
|
||||
}
|
||||
|
||||
void Plot::set_cursor_selectable(u32 id, bool selectable) {
|
||||
if (id >= cursors_.size()) return;
|
||||
cursors_[id].selectable = selectable;
|
||||
}
|
||||
|
||||
void Plot::set_annotation(u32 id, const Annotation& annotation) {
|
||||
if (id >= annotations_.size()) return;
|
||||
annotations_[id] = annotation;
|
||||
|
||||
Reference in new issue
Block a user