Re: [w3c/gamepad] Add buttondown, buttonup, buttonchange, axischange events (#152)

> which would result in two axischange events with the same timestamp (but different axis indices).

Could/should we combine those into a single event?

> Perhaps there should be a gamepadchange event that fires at some reasonable time synchronized to rAF and provides coalesced events, and a rawgamepadchange event that fires for every change and doesn't coalesce?

Yeah, that's what I'm thinking too. That seems to fit with pointer events nicely.

> I'm looking at the [pointermove](https://www.w3.org/TR/pointerevents3/#the-pointermove-event) spec and it looks there's no guidance on when the event should be fired if it's delayed.

Yeah _sigh_ I'm sad that they haven't done that.

> For gamepadchange I think it would be good to explicitly specify that if there's a pending gamepadchange event then it must be fired before rAF.

Agreed! It'd be good to lead the way here and show pointerevents how it should be done 😄. 

https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model steps 11.7-11.12 handle various events that shouls be sync'd to rAF, so I guess the gamepad stuff should go in there.

What about button presses? Do you think those should happen immediately? Mouse clicks do. It's something like this:

On mouse button down:

1. If the mouse position has changed since the last `mousemove` event, dispatch a `mousemove` event.
2. Dispatch a `mousedown` event.

So the mouse-down flushes the queued `mousemove` event.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/152#issuecomment-906227988

Received on Thursday, 26 August 2021 09:04:17 UTC