From 3076e1392061d9e06d84dbdbc8543f8c78aee256 Mon Sep 17 00:00:00 2001
From: goat <16760685+goaaats@users.noreply.github.com>
Date: Tue, 6 Apr 2021 15:41:34 +0200
Subject: [PATCH] feat: add SetWindowPosRelativeMainViewport to ImGuiHelpers
---
Dalamud/Interface/ImGuiHelpers.cs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Dalamud/Interface/ImGuiHelpers.cs b/Dalamud/Interface/ImGuiHelpers.cs
index 90d8d6cfb..54e9fab30 100644
--- a/Dalamud/Interface/ImGuiHelpers.cs
+++ b/Dalamud/Interface/ImGuiHelpers.cs
@@ -37,10 +37,26 @@ namespace Dalamud.Interface
public static void ScaledRelativeSameLine(float offset, float spacing = -1.0f) =>
ImGui.SameLine(ImGui.GetCursorPosX() + (offset * GlobalScale));
+ ///
+ /// Set the position of the next window relative to the main viewport.
+ ///
+ /// The position of the next window.
+ /// When to set the position.
+ /// The pivot to set the position around.
public static void SetNextWindowPosRelativeMainViewport(
Vector2 position, ImGuiCond condition = ImGuiCond.None, Vector2 pivot = default)
=> ImGui.SetNextWindowPos(position + MainViewport.Pos, condition, pivot);
+ ///
+ /// Set the position of a window relative to the main viewport.
+ ///
+ /// The name/ID of the window.
+ /// The position of the window.
+ /// When to set the position.
+ public static void SetWindowPosRelativeMainViewport(
+ string name, Vector2 position, ImGuiCond condition = ImGuiCond.None)
+ => ImGui.SetWindowPos(position + MainViewport.Pos, condition);
+
///
/// Get data needed for each new frame.
///