mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix: only allow pinning/clickthrough if the window is within the main viewport
This commit is contained in:
parent
f10a597566
commit
c03d6ff048
2 changed files with 30 additions and 6 deletions
|
|
@ -25,6 +25,13 @@ public static class ImGuiHelpers
|
|||
/// </summary>
|
||||
public static float GlobalScale { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if the current ImGui window is on the main viewport.
|
||||
/// Only valid within a window.
|
||||
/// </summary>
|
||||
/// <returns>Whether the window is on the main viewport.</returns>
|
||||
public static bool CheckIsWindowOnMainViewport() => MainViewport.ID == ImGui.GetWindowViewport().ID;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -362,6 +362,11 @@ public abstract class Window
|
|||
|
||||
if (ImGui.BeginPopup(additionsPopupName, ImGuiWindowFlags.NoMove))
|
||||
{
|
||||
var isAvailable = ImGuiHelpers.CheckIsWindowOnMainViewport();
|
||||
|
||||
if (!isAvailable)
|
||||
ImGui.BeginDisabled();
|
||||
|
||||
if (this.internalIsClickthrough)
|
||||
ImGui.BeginDisabled();
|
||||
|
||||
|
|
@ -391,12 +396,24 @@ public abstract class Window
|
|||
this.internalAlpha = null;
|
||||
}
|
||||
|
||||
if (isAvailable)
|
||||
{
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey,
|
||||
Loc.Localize("WindowSystemContextActionClickthroughDisclaimer",
|
||||
"Open this menu again to disable clickthrough."));
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey,
|
||||
Loc.Localize("WindowSystemContextActionDisclaimer",
|
||||
"These options may not work for all plugins at the moment."));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey,
|
||||
Loc.Localize("WindowSystemContextActionViewportDisclaimer",
|
||||
"These features are only available if this window is inside the game window."));
|
||||
}
|
||||
|
||||
if (!isAvailable)
|
||||
ImGui.EndDisabled();
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue