From 0e9b94e9ac0e47626b7b82ea0b7e0d449499d5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Mon, 2 Jun 2025 08:29:49 +0200 Subject: [PATCH] gui: getsize and getpos returns the value that was computed by last update isntead of computing --- WickedEngine/wiGUI.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index ad8aa7b57..34800eb65 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -530,13 +530,11 @@ namespace wi::gui } XMFLOAT2 Widget::GetPos() const { - XMFLOAT3 transform_position = TransformComponent::GetPosition(); - return *(XMFLOAT2*)&transform_position; + return *(XMFLOAT2*)&translation; } XMFLOAT2 Widget::GetSize() const { - XMFLOAT3 transform_scale = TransformComponent::GetScale(); - return *(XMFLOAT2*)&transform_scale; + return *(XMFLOAT2*)&scale; } WIDGETSTATE Widget::GetState() const { @@ -4919,7 +4917,7 @@ namespace wi::gui y -= widget.GetSize().y; y -= padding; widget.SetPos(XMFLOAT2(margin_left, y)); - widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetSize().y)); }; auto add_right = [&](wi::gui::Widget& widget) { if (!widget.IsVisible())