From 66c0be642f78f1b3d5cbef2aa0b87f6c84df1f60 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Wed, 9 May 2018 16:00:46 +0200 Subject: [PATCH] Fix relative mouse motion when captured in HTML5 platform (cherry picked from commit d78b10313b78e56a65ef4fdfeef6d85ae8ad5311) --- platform/javascript/os_javascript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 0f057d929d2..017922ba1d7 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -196,7 +196,7 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m ev->set_position(pos); ev->set_global_position(ev->get_position()); - ev->set_relative(ev->get_position() - _input->get_mouse_position()); + ev->set_relative(Vector2(mouse_event->movementX, mouse_event->movementY)); _input->set_mouse_position(ev->get_position()); ev->set_speed(_input->get_last_mouse_speed());