rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.21k stars 261 forks source link

virtualjoystick timeDown,timeUp and timeStamp not matching #202

Closed OADesigns closed 3 years ago

OADesigns commented 3 years ago

The time amount in timeDown, timeUp and in the path originalEvent.timeStamp seem to be off. It's way different from the amount from a regular cursor pressed at the same time and is about 13 digits long without a period. The time in path ._events.down.context.time.now seems to be correct though.

rexrainbow commented 3 years ago

VirtualJoystick does not pass real native DOM Keyboard event to Key object. It reuses a plain object to change the state of Key object (key.timeDown, key.timeUp, key.duration), therefore, key.originalEvent is meaningless here.

BTW, key.timeDown, key.timeUp, key.duration properties are not correctly, fixed in latest minify file already.

OADesigns commented 3 years ago

Thanks for clarifying I wasn't entirely sure what I was looking at. I realize now that its returning milliseconds from a date.now function and I was trying to replicate the timestamp that you get from Phaser events attached to the game clock. I ended up using the timestamp from the event triggered from the pointer, you can close this issue if you'd like thanks for your help.