-
Notifications
You must be signed in to change notification settings - Fork 60
Make Gamepad and Touch Controls Mutually Exclusive [AARD-1945]
#1229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…h modes mutually exclusive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
const [useGamepad, setUseGamepad] = useState<boolean>(selectedScheme.usesGamepad) | ||
const [useTouchControls, setUseTouchControls] = useState<boolean>(selectedScheme.usesTouchControls) | ||
const [useGamepad, setUseGamepad] = useState(selectedScheme.usesGamepad) | ||
const [useTouchControls, setUseTouchControls] = useState(selectedScheme.usesTouchControls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel as though keeping the will help with code readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think usesGamepad
and usesTouchControls
are pretty clearly boolean values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be a bit more clear I mean that it doesn't necessarily hurt to keep <boolean>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to merge dev
const [useGamepad, setUseGamepad] = useState<boolean>(selectedScheme.usesGamepad) | ||
const [useTouchControls, setUseTouchControls] = useState<boolean>(selectedScheme.usesTouchControls) | ||
const [useGamepad, setUseGamepad] = useState(selectedScheme.usesGamepad) | ||
const [useTouchControls, setUseTouchControls] = useState(selectedScheme.usesTouchControls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think usesGamepad
and usesTouchControls
are pretty clearly boolean values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Task
AARD-1945
Symptom
Previously, both "Use Controller" and "Use Touch Controls" could be enabled, in which case the UI would show the configuration for the controller. This doesn't really make sense because the use touch controls property is basically ignored (although still set in the JS object)

Solution
Updated checkboxes to allow passing your own state variable, while still keeping the old "stateless" option to avoid requiring extra code wherever checkboxes are used
Verification
Opened the input configuration panel and attempted to turn both on, and observed that while both could be off, turning on one would turn off the other. I also opened the robot switch panel to confirm that the index-based checkboxes still worked as intended. I also opened the preference panel to confirm that normal checkboxes worked correctly.
Before merging, ensure the following criteria are met: