diff --git a/Working-for-Web-(HTML5).md b/Working-for-Web-(HTML5).md index efaeb1b..f127ae6 100644 --- a/Working-for-Web-(HTML5).md +++ b/Working-for-Web-(HTML5).md @@ -334,18 +334,23 @@ A: WindowShouldClose waits for a fixed period of time (16ms in Raylib 5.5, 12ms * [Performance.now](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) * [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame) -Q: Jerky and slow mouse movement with DisableCursor +Q: Jerky and slow mouse movement with DisableCursor? A: This seems to have two causes: 1. RayLib only reports the most recent mouse event, however a browser might send several of these in a frame. In the RayLib function EmscriptenMouseMoveCallback try replacing the following two lines +```c CORE.Input.Mouse.previousPosition.x = lockedMousePos.x - mouseEvent->movementX; CORE.Input.Mouse.previousPosition.y = lockedMousePos.y - mouseEvent->movementY; -with +``` +> with +```c CORE.Input.Mouse.previousPosition.x -= mouseEvent->movementX; CORE.Input.Mouse.previousPosition.y -= mouseEvent->movementY; +``` 2. By default some browsers (notably Chrome) send large mouse movement spikes unless you specifically request raw inputs. Since Emscripten doesn't send this flag you can sneak it in by adding the following script to your shell html file +```javascript HTMLElement.prototype._requestPointerLock = HTMLElement.prototype.requestPointerLock; HTMLElement.prototype.requestPointerLock = function(options) { @@ -358,5 +363,6 @@ with return this.requestPointerLock(); } } +``` **Please, feel free to add here your FAQ/Issues to help others!!!**