diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 89ec5636ab7..2f0cfda898a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2073,7 +2073,7 @@ void Viewport::_gui_input_event(Ref p_event) { Window *w = Object::cast_to(ObjectDB::get_instance(object_under)); if (w) { viewport_under = w; - viewport_pos = screen_mouse_pos - w->get_position(); + viewport_pos = w->get_final_transform().affine_inverse().xform(screen_mouse_pos - w->get_position()); } } }