pgui: Fix bugs with pgSliderBar dragging

Closes #1722
This commit is contained in:
jtfedd 2025-02-15 20:56:07 -06:00 committed by rdb
parent c352e92dbc
commit 56cdea16c9
1 changed files with 6 additions and 1 deletions

View File

@ -693,6 +693,11 @@ advance_scroll() {
*/
void PGSliderBar::
advance_page() {
// Do not try to advance the page while dragging
if (_dragging) {
return;
}
// Is the mouse position left or right of the current thumb position?
LPoint3 mouse = mouse_to_local(_mouse_pos) - _thumb_start;
PN_stdfloat target_ratio = mouse.dot(_axis) / _range_x;
@ -705,7 +710,7 @@ advance_page() {
t = min(_ratio + _page_ratio - _scroll_ratio, target_ratio);
}
internal_set_ratio(t);
if (t == target_ratio) {
if (_ratio == target_ratio) {
// We made it; begin dragging from now on until the user releases the
// mouse.
begin_drag();