Use AtkResNode to get height for tooltips

This commit is contained in:
Infi
2024-04-07 21:25:10 +02:00
parent d9114aeb0e
commit aad4fc70af
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -239,10 +239,12 @@ public sealed class PayloadHandler {
return;
var atk = (AtkUnitBase*) args.Addon;
if (atk == null)
if (atk->WindowNode == null)
return;
var atkSize = (X: atk->GetScaledWidth(true), Y: atk->GetScaledHeight(true));
var component = atk->WindowNode->AtkResNode;
var atkSize = (X: component.GetWidth() * component.ScaleX, Y: component.GetHeight() * component.GetScaleY());
var viewportSize = ImGuiHelpers.MainViewport.Size;
var window = LogWindow.LastWindowPos + LogWindow.LastWindowSize;
var isLeft = window.X < viewportSize.X / 2;
@@ -251,6 +253,7 @@ public sealed class PayloadHandler {
var x = isLeft ? window.X : LogWindow.LastWindowPos.X - atkSize.X;
var y = Math.Clamp(window.Y - atkSize.Y, 0, float.MaxValue);
y -= isTop ? 0 : LogWindow.Plugin.Config.TooltipOffset; // offset to prevent cut-off on the bottom
atk->SetPosition((short) x, (short) y);
}