From 3e30dd79547bbba9cac337f930de50614cfbdac2 Mon Sep 17 00:00:00 2001 From: Zae Date: Thu, 10 Oct 2024 03:08:04 +0800 Subject: [PATCH] Fix incorrect drag preview position under transformed CanvasLayer. --- scene/main/viewport.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 169a5dcb014..889f7743f6a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1987,7 +1987,8 @@ void Viewport::_gui_input_event(Ref p_event) { Control *drag_preview = _gui_get_drag_preview(); if (drag_preview) { - drag_preview->set_position(mpos); + Vector2 pos = drag_preview->get_canvas_transform().affine_inverse().xform(mpos); + drag_preview->set_position(pos); } gui.drag_mouse_over = section_root->gui.target_control;