From 6e549d41eb4fdbdcde0f609ff09c97691a888bd6 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Tue, 28 Nov 2017 23:30:57 +0100 Subject: [PATCH] Fix inverted relative mouse motion in HTML5 export (cherry picked from commit 640d8cc5d2749bbe29a6a85d076a7bdf264d146b) --- platform/javascript/os_javascript.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 8e8faf2df4b..0c092f4f0b1 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -189,8 +189,8 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m ev.mouse_motion.global_x = ev.mouse_motion.x = mouse_event->canvasX; ev.mouse_motion.global_y = ev.mouse_motion.y = mouse_event->canvasY; - ev.mouse_motion.relative_x = _input->get_mouse_pos().x - ev.mouse_motion.x; - ev.mouse_motion.relative_y = _input->get_mouse_pos().y - ev.mouse_motion.y; + ev.mouse_motion.relative_x = ev.mouse_motion.x - _input->get_mouse_pos().x; + ev.mouse_motion.relative_y = ev.mouse_motion.y - _input->get_mouse_pos().y; _input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); ev.mouse_motion.speed_x = _input->get_mouse_speed().x; @@ -310,8 +310,8 @@ static EM_BOOL _touchmove_callback(int event_type, const EmscriptenTouchEvent *t ev.mouse_motion.button_mask = _input->get_mouse_button_mask() >> 1; ev.mouse_motion.global_x = ev.mouse_motion.x = touch_event->touches[lowest_id_index].canvasX; ev.mouse_motion.global_y = ev.mouse_motion.y = touch_event->touches[lowest_id_index].canvasY; - ev.mouse_motion.relative_x = _input->get_mouse_pos().x - ev.mouse_motion.x; - ev.mouse_motion.relative_y = _input->get_mouse_pos().y - ev.mouse_motion.y; + ev.mouse_motion.relative_x = ev.mouse_motion.x - _input->get_mouse_pos().x; + ev.mouse_motion.relative_y = ev.mouse_motion.y - _input->get_mouse_pos().y; _input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); ev.mouse_motion.speed_x = _input->get_mouse_speed().x;