Skip to content

Potential Fix for Joysticks on New Versions of Chrome#16

Open
ExploitSage wants to merge 3 commits into221robotics:masterfrom
ExploitSage:bugfix/#15-gamepads
Open

Potential Fix for Joysticks on New Versions of Chrome#16
ExploitSage wants to merge 3 commits into221robotics:masterfrom
ExploitSage:bugfix/#15-gamepads

Conversation

@ExploitSage
Copy link
Contributor

@ExploitSage ExploitSage commented Mar 20, 2021

This still warrants more testing as I only had one XBox 360 Clone controller to test with, but what I was able to test works beautifully. I also haven't been able to test Chrome 53 since that is officially being recommended, as I don't have a Windows machine handy.

Not sure if there were previous issues that have since been resolved, but it looks like the issue here is that somewhere along the way, "empty" joysticks went from being undefined to null in the array returned by navigator.getGamepads(). Unfortunately typeof null is 'object' as is the type of an actual Gamepad object, so no changes to the array were being processed. I have re-worked the logic to use true/false and check explicitly for null. Possible this could break again in the future I guess, but it does seem to work now.

fix #15

@ExploitSage
Copy link
Contributor Author

I should modify this to handle both null and undefined for backwards compatibility, not sure what I was thinking? Will do that later today when I get a chance.

@ajlapp
Copy link
Member

ajlapp commented Mar 27, 2021

Excellent work. We’ll review and get this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gamepad controller not working with RobotOpenDS

2 participants