From f01e1ce1dde0b8d3a5067622a23a2a9da6c2827e Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Thu, 28 Apr 2022 00:18:32 +0200 Subject: [PATCH] Inlcude CanvasLayer transform into calculation of Control screen position --- scene/gui/control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 35d1cf1f3e1..4f2f853be95 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2070,7 +2070,7 @@ Point2 Control::get_global_position() const { Point2 Control::get_screen_position() const { ERR_FAIL_COND_V(!is_inside_tree(), Point2()); - Point2 global_pos = get_viewport()->get_canvas_transform().xform(get_global_position()); + Point2 global_pos = get_global_transform_with_canvas().get_origin(); Window *w = Object::cast_to(get_viewport()); if (w && !w->is_embedding_subwindows()) { global_pos += w->get_position();