Skip to content

Conversation

@dmarcos
Copy link
Member

@dmarcos dmarcos commented Oct 23, 2017

No description provided.

@dmarcos dmarcos changed the title Remove everGotGamepadEvent flag (fix #2769) Remove everGotGamepadEvent flag and gamepadconnected / gamepaddisconnected handlers (fix #2769) Oct 23, 2017
@dmarcos
Copy link
Member Author

dmarcos commented Oct 23, 2017

@fernandojsg ?

@dmarcos dmarcos requested a review from fernandojsg October 23, 2017 21:10
@fernandojsg
Copy link
Member

@dmarcos it works! :)

@machenmusik
Copy link
Contributor

nice catch

@vincentfretin
Copy link
Contributor

There is a this.everGotGamepadEvent variable in gearvr-controls.js that seems unused, you may want to remove it too.

},

onGamepadConnectionEvent: function (evt) {
this.everGotGamepadEvent = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, per @vincentfretin's comment, there are a few more:

src/components/gearvr-controls.js
59:    this.everGotGamepadEvent = false;

tests/components/daydream-controls.test.js
198:      // Reset everGotGamepadEvent so we don't think we've looked before.
199:      delete component.everGotGamepadEvent;

tests/components/gearvr-controls.test.js
211:      // Reset everGotGamepadEvent so we don't think we've looked before.
212:      delete component.everGotGamepadEvent;

tests/components/oculus-touch-controls.test.js
166:      // Reset everGotGamepadEvent so we don't think we've looked before.
167:      delete component.everGotGamepadEvent;

tests/components/vive-controls.test.js
194:      // Reset everGotGamepadEvent to mock not looked before.
195:      delete component.everGotGamepadEvent;

tests/components/windows-motion-controls.test.js
533:      // Reset everGotGamepadEvent so we don't think we've looked before.
534:      delete component.everGotGamepadEvent;

…ected

handlers (fix aframevr#2769)

We moved away from using gamepadconnected / gamepaddisconnected events
from the rest of the controls. We forgot to remove the handlers from
daydream-controls. This was causing problems where sometimes gamepadconnected was
fired before tracked-controls had a chance to update controllers and emit controllersupdated. The
flag everGotGamepadEvent was set to true leaving onControllersUpdate
without effect after tracked-controls had updated the controllers list.
The timing of the gamepadconnected event seems to have changed in Chrome
Daydream and this problem had not manifested before.
@dmarcos dmarcos merged commit e8f5f97 into aframevr:master Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants