aboutsummaryrefslogtreecommitdiff
path: root/src/library_sdl.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-06 14:46:56 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-06 14:46:56 -0700
commitd5f8e78bfaad5e08a229d8cd4a75b54c050b7463 (patch)
treeb63c09867d09ed0a48ca3f4ea3e9bef41704a4d3 /src/library_sdl.js
parente620e1086313d7e0407d9a172e709f25425121cb (diff)
fix mousemove workaround
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r--src/library_sdl.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index ab7aa244..da1e88af 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -348,14 +348,18 @@ var LibrarySDL = {
receiveEvent: function(event) {
switch(event.type) {
case 'mousemove':
- // workaround for firefox bug 750111
- event['movementX'] = event['mozMovementX'];
- event['movementY'] = event['mozMovementY'];
- // workaround for Firefox bug 782777
- if (event['movementX'] == 0 &&
- event['movementY'] == 0) {
- // ignore a mousemove event if it doesn't contain any movement info
- return;
+ if (Browser.pointerLock) {
+ // workaround for firefox bug 750111
+ if ('mozMovementX' in event) {
+ event['movementX'] = event['mozMovementX'];
+ event['movementY'] = event['mozMovementY'];
+ }
+ // workaround for Firefox bug 782777
+ if (event['movementX'] == 0 && event['movementY'] == 0) {
+ // ignore a mousemove event if it doesn't contain any movement info
+ // (without pointer lock, we infer movement from pageX/pageY, so this check is unnecessary)
+ return false;
+ }
}
// fall through
case 'keydown': case 'keyup': case 'mousedown': case 'mouseup': case 'DOMMouseScroll': case 'mousewheel':