Fix inverted relative mouse motion in HTML5 export

(cherry picked from commit 640d8cc5d2)
This commit is contained in:
Leon Krause 2017-11-28 23:30:57 +01:00
parent c445ba29aa
commit 6e549d41eb

View File

@ -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;