openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
754 stars 371 forks source link

HTML5 backend doesn't support setMouseLock #1730

Open BSlug opened 10 months ago

BSlug commented 10 months ago

The HTML5 backend's function to lock the pointer is currently NOP.

Only calling the canvas field's requestPointerLock() method is insufficient. Rather than using a mousemove event's movementX/movementY fields to determine relative mouse movement, the backend currently uses cached clientX and clientY, which has the unfortunate side-effect of not working when the pointer is locked.

joshtynjala commented 10 months ago

I'm guessing that requestPointerLock() didn't exist at the time that mouse lock was originally implemented for the other targets that support it, so that's why it's NOOP for now.

It's probably not too difficult to switch to movementX/movementY once support is added.