From f8c5f9c9db5cc3030b7c8144f69d400a6455e833 Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Wed, 8 Nov 2023 04:24:10 -0800 Subject: [PATCH] Fix viewport offset on RecipeNote --- Craftimizer/Windows/RecipeNote.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index 21a3b2a..5abd350 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -41,7 +41,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNavFocus; - public enum CraftableStatus + public enum CraftableStatus { OK, LockedClassJob, @@ -71,7 +71,7 @@ public enum CraftableStatus private IDalamudTextureWrap NoManipulationBadge { get; } private GameFontHandle AxisFont { get; } - public RecipeNote() : base("Craftimizer RecipeNote", WindowFlags, false) + public RecipeNote() : base("Craftimizer RecipeNote", WindowFlags) { ExpertBadge = Service.IconManager.GetAssemblyTexture("Graphics.expert_badge.png"); CollectibleBadge = Service.IconManager.GetAssemblyTexture("Graphics.collectible_badge.png"); @@ -85,6 +85,12 @@ public RecipeNote() : base("Craftimizer RecipeNote", WindowFlags, false) ShowCloseButton = false; IsOpen = true; + SizeConstraints = new WindowSizeConstraints + { + MinimumSize = new(-1), + MaximumSize = new(10000, 10000) + }; + Service.WindowSystem.AddWindow(this); } @@ -182,12 +188,7 @@ public override void PreDraw() var node = (AtkResNode*)Addon->Unk458; // unit.GetNodeById(59); var nodeParent = Addon->Unk258; // unit.GetNodeById(57); - Position = pos + new Vector2(size.X, (nodeParent->Y + node->Y) * scale); - SizeConstraints = new WindowSizeConstraints - { - MinimumSize = new(-1), - MaximumSize = new(10000, 10000) - }; + Position = ImGuiHelpers.MainViewport.Pos + pos + new Vector2(size.X, (nodeParent->Y + node->Y) * scale); } public override void Draw()