From 4213b6e85f50ae2f0a017c6cdc7b48154aa169eb Mon Sep 17 00:00:00 2001 From: Daniel Poveda Date: Sun, 12 Oct 2025 20:36:39 +0200 Subject: [PATCH] feat: connection lines --- Content/UI/WBP_SkillTree.uasset | 4 ++-- Source/UTAD_UI/SkillTree/SkillTreeConnectionsWidget.cpp | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Content/UI/WBP_SkillTree.uasset b/Content/UI/WBP_SkillTree.uasset index 39187a2..baf0545 100644 --- a/Content/UI/WBP_SkillTree.uasset +++ b/Content/UI/WBP_SkillTree.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1f2f38f61363ac4354d0a670ec7c59a3997b684f33ec59982f01cf24ecec74e -size 330219 +oid sha256:7b90a26d5344102955f9da4ac7074e098914708a6950d6edba0b0da55364088f +size 336111 diff --git a/Source/UTAD_UI/SkillTree/SkillTreeConnectionsWidget.cpp b/Source/UTAD_UI/SkillTree/SkillTreeConnectionsWidget.cpp index 641a908..52e5a6d 100644 --- a/Source/UTAD_UI/SkillTree/SkillTreeConnectionsWidget.cpp +++ b/Source/UTAD_UI/SkillTree/SkillTreeConnectionsWidget.cpp @@ -257,9 +257,6 @@ int32 USkillTreeConnectionsWidget::NativePaint( TArray NodeInfoList; BuildNodeInfoList(NodeInfoList); - // Get this widget's absolute position to convert coordinates - FVector2D ConnectionsWidgetAbsolutePosition = AllottedGeometry.GetAbsolutePosition(); - // Draw lines for each node's prerequisites for (const FSkillNodeInfo& DependentNode : NodeInfoList) { @@ -277,9 +274,9 @@ int32 USkillTreeConnectionsWidget::NativePaint( if (!PrereqNode) continue; - // Convert absolute positions to local coordinates relative to this widget - FVector2D PrereqLocalPos = PrereqNode->Position - ConnectionsWidgetAbsolutePosition; - FVector2D DependentLocalPos = DependentNode.Position - ConnectionsWidgetAbsolutePosition; + // Convert absolute/screen positions to local space of this widget using Slate geometry + FVector2D PrereqLocalPos = AllottedGeometry.AbsoluteToLocal(PrereqNode->Position); + FVector2D DependentLocalPos = AllottedGeometry.AbsoluteToLocal(DependentNode.Position); // Draw line from prerequisite to dependent TArray LinePoints;