Controllers: classic sliders are focus targets; the D-pad nudges with A held

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-14 18:42:13 +02:00
parent b58e96436a
commit 79ea17ffc5
3 changed files with 17 additions and 1 deletions
@@ -263,6 +263,18 @@ impl Game<'_> {
self.pad_take_pointer(event_loop);
return;
}
// With A held (a slider grabbed, a drag), the D-pad nudges instead.
if self.pad.menu.held[0] {
let (dx, dy) = match button {
Button::DPadLeft => (-2.0, 0.0),
Button::DPadRight => (2.0, 0.0),
Button::DPadUp => (0.0, -2.0),
_ => (0.0, 2.0),
};
let at = self.cursor;
self.pad_pointer_to(event_loop, (at.0 + dx, at.1 + dy));
return;
}
let from = self.cursor;
let targets = self.pad_targets();
if let Some(i) = gamepad::focus_step(from, button, &targets) {
+4
View File
@@ -283,6 +283,10 @@ pub fn slider(
hover: bool,
active: bool,
) {
if active {
// A controller's D-pad can focus it (Horizon's controller support).
crate::widgets::target([x, y, w, 20.0]);
}
let track = if hover && active {
"gui/sprites/widget/slider_highlighted"
} else {