Files
OrcaSlicer/deps_src
Noisyfox 66d3f3f9c3 imgui: Clamp mouse y-coordinate in multi-line click/drag to text bounds (#15052)
* imgui: Clamp mouse y-coordinate in multi-line click/drag to text bounds

In single-line mode, click and drag already clamped y to the line's
y-coordinate so the cursor would continue to follow the x-position when
the mouse went off the top or bottom of the text.  Multi-line mode did
not clamp, so stb_text_locate_coord() would return 0 (above) or n
(below), snapping the cursor to the very start or end of text and
ignoring the x-coordinate entirely.

Now both modes walk the row layout to compute the top of the first row
(y_min) and bottom of the last row (y_max, minus half a line height to
add tolerance for rounding), then clamp y to that range before passing
it to stb_text_locate_coord().  This means dragging or clicking above
the text now places the cursor on the first line at the x-coordinate,
and dragging/clicking below places it on the last line at the
x-coordinate, matching the single-line precedent.

* Fix issue that cursor cannot be placed at the last empty line
2026-08-03 18:34:05 +08:00
..
2025-09-26 17:16:20 +08:00
2026-07-02 17:49:36 +08:00
2025-08-22 20:02:26 +08:00
2025-08-22 20:02:26 +08:00