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>
|
/// </summary>
|
||||||
public static float GlobalScale { get; private set; }
|
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>
|
/// <summary>
|
||||||
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -362,6 +362,11 @@ public abstract class Window
|
||||||
|
|
||||||
if (ImGui.BeginPopup(additionsPopupName, ImGuiWindowFlags.NoMove))
|
if (ImGui.BeginPopup(additionsPopupName, ImGuiWindowFlags.NoMove))
|
||||||
{
|
{
|
||||||
|
var isAvailable = ImGuiHelpers.CheckIsWindowOnMainViewport();
|
||||||
|
|
||||||
|
if (!isAvailable)
|
||||||
|
ImGui.BeginDisabled();
|
||||||
|
|
||||||
if (this.internalIsClickthrough)
|
if (this.internalIsClickthrough)
|
||||||
ImGui.BeginDisabled();
|
ImGui.BeginDisabled();
|
||||||
|
|
||||||
|
|
@ -391,13 +396,25 @@ public abstract class Window
|
||||||
this.internalAlpha = null;
|
this.internalAlpha = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey,
|
if (isAvailable)
|
||||||
Loc.Localize("WindowSystemContextActionClickthroughDisclaimer",
|
{
|
||||||
"Open this menu again to disable clickthrough."));
|
ImGui.TextColored(ImGuiColors.DalamudGrey,
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey,
|
Loc.Localize("WindowSystemContextActionClickthroughDisclaimer",
|
||||||
Loc.Localize("WindowSystemContextActionDisclaimer",
|
"Open this menu again to disable clickthrough."));
|
||||||
"These options may not work for all plugins at the moment."));
|
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();
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue