fix(input): clamp a dragged ruler on an ordered y range and share the orientation test

This commit is contained in:
Martino Ferrari committed 2026-09-28 17:58:42 +02:00
1 parent 93ad774281
commit a153b73ead
5 files changed
+62 -14

No files matched your search

+2 -2
View File
@@ -939,7 +939,7 @@ void Renderer::draw_cursors(const Plot& plot, const PlotLayout& layout) {
// stroke (and which axis maps the span it is drawn along), and where the label is
// written. Everything else -- the skip at the far edge of the axes, the highlight, the
// text path -- is this one loop's, which is the point of one type rather than two.
const bool horizontal = cursor.orientation == CursorOrientation::Horizontal;
const bool horizontal = cursor.is_horizontal();
const f32 at = plot.cursor_screen_coordinate(i);
// A cursor has no position on the plot when it is strictly outside its range's mapped
// span -- a marker scrolled past the right edge, a ruler past the bottom -- and the
@@ -985,7 +985,7 @@ void Renderer::draw_cursors(const Plot& plot, const PlotLayout& layout) {
void Renderer::draw_cursor_label(const Plot& plot, const PlotLayout& layout, const Cursor& cursor,
f32 at) {
const f32 gap = style_.device(3.0f);
if (cursor.orientation == CursorOrientation::Horizontal) {
if (cursor.is_horizontal()) {
// A ruler's text is the value it is *for*, written the way the y axis writes its own
// tick labels, so a value read off a ruler reads exactly like the tick beside it. The
// caller's caption, when there is one, is staged first on the same line, so neither the