Commit 3e5c4cec94aeb2dd0afd3e6c2a53210a4ff54b9e

Boris Gjenero 2016-09-13T00:03:46

Mouse events use CSS coordinates, so don't scale by pixel_ratio

diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 883b599..4bb0efb 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -308,8 +308,8 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent
     /* rescale (in case canvas is being scaled)*/
     double client_w, client_h, xscale, yscale;
     emscripten_get_element_css_size(NULL, &client_w, &client_h);
-    xscale = window_data->window->w / (client_w * window_data->pixel_ratio);
-    yscale = window_data->window->h / (client_h * window_data->pixel_ratio);
+    xscale = window_data->window->w / client_w;
+    yscale = window_data->window->h / client_h;
 
     /* check for pointer lock */
     int isPointerLockSupported = emscripten_get_pointerlock_status(&pointerlock_status);
@@ -371,8 +371,8 @@ Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEven
         double client_w, client_h;
         emscripten_get_element_css_size(NULL, &client_w, &client_h);
 
-        mx = mx * (window_data->window->w / (client_w * window_data->pixel_ratio));
-        my = my * (window_data->window->h / (client_h * window_data->pixel_ratio));
+        mx = mx * (window_data->window->w / client_w);
+        my = my * (window_data->window->h / client_h);
         SDL_SendMouseMotion(window_data->window, 0, isPointerLocked, mx, my);
     }