From 4cfe561c1c56f419eb23e7752315422909379397 Mon Sep 17 00:00:00 2001 From: Exter-N Date: Tue, 11 Nov 2025 21:28:30 +0100 Subject: [PATCH] Add a property to get the bounds of a DTR entry --- Dalamud/Game/Gui/Dtr/DtrBarEntry.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs b/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs index 6fdc504ca..f5b7011fe 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBarEntry.cs @@ -1,4 +1,6 @@ -using Dalamud.Configuration.Internal; +using System.Numerics; + +using Dalamud.Configuration.Internal; using Dalamud.Game.Addon.Events.EventDataTypes; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Plugin.Internal.Types; @@ -48,6 +50,11 @@ public interface IReadOnlyDtrBarEntry /// Gets an action to be invoked when the user clicks on the dtr entry. /// public Action? OnClick { get; } + + /// + /// Gets the axis-aligned bounding box of this entry, in screen coordinates. + /// + public (Vector2 Min, Vector2 Max) ScreenBounds { get; } } /// @@ -146,6 +153,17 @@ internal sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry [Api13ToDo("Maybe make this config scoped to internal name?")] public bool UserHidden => this.configuration.DtrIgnore?.Contains(this.Title) ?? false; + /// + public (Vector2 Min, Vector2 Max) ScreenBounds + => this.TextNode switch + { + null => default, + var node => node->IsVisible() + ? (new(node->ScreenX, node->ScreenY), + new(node->ScreenX + node->GetWidth(), node->ScreenY + node->GetHeight())) + : default, + }; + /// /// Gets or sets the internal text node of this entry. ///