fix transform localization event in mouse motion

(cherry picked from commit 08e0e64a19)
This commit is contained in:
Juan Linietsky 2016-02-27 09:47:39 -03:00 committed by Rémi Verschelde
parent ee5c250b63
commit aa94ff6dae

View file

@ -1803,6 +1803,7 @@ void Viewport::_gui_input_event(InputEvent p_event) {
} }
if (gui.drag_data.get_type()==Variant::NIL && over && !gui.modal_stack.empty()) { if (gui.drag_data.get_type()==Variant::NIL && over && !gui.modal_stack.empty()) {
Control *top = gui.modal_stack.back()->get(); Control *top = gui.modal_stack.back()->get();
@ -1836,7 +1837,7 @@ void Viewport::_gui_input_event(InputEvent p_event) {
} }
Matrix32 localizer = over->get_canvas_transform().affine_inverse(); Matrix32 localizer = over->get_global_transform_with_canvas().affine_inverse();
Size2 pos = localizer.xform(mpos); Size2 pos = localizer.xform(mpos);
Vector2 speed = localizer.basis_xform(Point2(p_event.mouse_motion.speed_x,p_event.mouse_motion.speed_y)); Vector2 speed = localizer.basis_xform(Point2(p_event.mouse_motion.speed_x,p_event.mouse_motion.speed_y));
Vector2 rel = localizer.basis_xform(Point2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y)); Vector2 rel = localizer.basis_xform(Point2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y));
@ -1871,7 +1872,7 @@ void Viewport::_gui_input_event(InputEvent p_event) {
} }
pos = gui.focus_inv_xform.xform(pos); //pos = gui.focus_inv_xform.xform(pos);
p_event.mouse_motion.x = pos.x; p_event.mouse_motion.x = pos.x;