Tab interactions: Make it possible to scroll tabs without activating them, by handling TouchInputFlags::UP/CANCEL properly.

This commit is contained in:
Henrik Rydgård committed 2026-04-24 14:13:33 +02:00
1 parent 575e08ff6c
commit a1a073bd2c
1 file changed
+7 -2
+7 -2
View File
@@ -344,7 +344,6 @@ bool Clickable::Key(const KeyInput &key) {
bool StickyChoice::Touch(const TouchInput &touch) {
bool contains = bounds_.Contains(touch.x, touch.y);
dragging_ = false;
if (!IsEnabled()) {
down_ = false;
return contains;
@@ -352,12 +351,18 @@ bool StickyChoice::Touch(const TouchInput &touch) {
if (touch.flags & TouchInputFlags::DOWN) {
if (contains) {
dragging_ = true;
}
}
if (touch.flags & TouchInputFlags::UP) {
if (dragging_ && contains && !(touch.flags & TouchInputFlags::CANCEL)) {
if (IsFocusMovementEnabled())
SetFocusedView(this);
down_ = true;
ClickInternal();
dragging_ = false;
return true;
}
dragging_ = false;
}
return false;
}