mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-20 15:44:18 +01:00
feat: scale window size in Window by GlobalScale
This commit is contained in:
parent
7ef0456582
commit
ec8e320b6c
1 changed files with 28 additions and 3 deletions
|
|
@ -9,7 +9,8 @@ namespace Dalamud.Interface.Windowing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class Window
|
public abstract class Window
|
||||||
{
|
{
|
||||||
private bool internalIsOpen;
|
private bool internalLastIsOpen = false;
|
||||||
|
private bool internalIsOpen = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Window"/> class.
|
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||||
|
|
@ -99,6 +100,16 @@ namespace Dalamud.Interface.Windowing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Draw();
|
public abstract void Draw();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Code to be executed when the window is opened.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnOpen() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Code to be executed when the window is closed.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnClose() { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draw the window via ImGui.
|
/// Draw the window via ImGui.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -116,6 +127,20 @@ namespace Dalamud.Interface.Windowing
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.internalLastIsOpen != this.internalIsOpen)
|
||||||
|
{
|
||||||
|
if (this.internalIsOpen)
|
||||||
|
{
|
||||||
|
this.OnOpen();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.OnClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.internalLastIsOpen = this.internalIsOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyConditionals()
|
private void ApplyConditionals()
|
||||||
|
|
@ -127,7 +152,7 @@ namespace Dalamud.Interface.Windowing
|
||||||
|
|
||||||
if (this.Size.HasValue)
|
if (this.Size.HasValue)
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowPos(this.Size.Value, this.SizeCondition);
|
ImGui.SetNextWindowPos(this.Size.Value * ImGuiHelpers.GlobalScale, this.SizeCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.Collapsed.HasValue)
|
if (this.Collapsed.HasValue)
|
||||||
|
|
@ -137,7 +162,7 @@ namespace Dalamud.Interface.Windowing
|
||||||
|
|
||||||
if (this.SizeConstraintsMin.HasValue && this.SizeConstraintsMax.HasValue)
|
if (this.SizeConstraintsMin.HasValue && this.SizeConstraintsMax.HasValue)
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowSizeConstraints(this.SizeConstraintsMin.Value, this.SizeConstraintsMax.Value);
|
ImGui.SetNextWindowSizeConstraints(this.SizeConstraintsMin.Value * ImGuiHelpers.GlobalScale, this.SizeConstraintsMax.Value * ImGuiHelpers.GlobalScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue