mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix(Window): use a struct for SizeConstraints, you can't set them separately
This commit is contained in:
parent
53c29c1991
commit
ac83077863
2 changed files with 25 additions and 10 deletions
|
|
@ -31,7 +31,11 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.dalamud = dalamud;
|
||||
this.documents.Add(new ScratchpadDocument());
|
||||
|
||||
this.SizeConstraintsMin = new Vector2(400, 400);
|
||||
this.SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(400, 400),
|
||||
MaximumSize = new Vector2(1000, 1000),
|
||||
};
|
||||
|
||||
this.Execution = new ScratchExecutionManager(dalamud);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,14 +61,9 @@ namespace Dalamud.Interface.Windowing
|
|||
public ImGuiCond SizeCondition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum size of this window.
|
||||
/// Gets or sets the size constraints of the window.
|
||||
/// </summary>
|
||||
public Vector2? SizeConstraintsMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum size of this window.
|
||||
/// </summary>
|
||||
public Vector2? SizeConstraintsMax { get; set; }
|
||||
public WindowSizeConstraints? SizeConstraints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether or not this window is collapsed.
|
||||
|
|
@ -219,9 +214,9 @@ namespace Dalamud.Interface.Windowing
|
|||
ImGui.SetNextWindowCollapsed(this.Collapsed.Value, this.CollapsedCondition);
|
||||
}
|
||||
|
||||
if (this.SizeConstraintsMin.HasValue && this.SizeConstraintsMax.HasValue)
|
||||
if (this.SizeConstraints.HasValue)
|
||||
{
|
||||
ImGui.SetNextWindowSizeConstraints(this.SizeConstraintsMin.Value * ImGuiHelpers.GlobalScale, this.SizeConstraintsMax.Value * ImGuiHelpers.GlobalScale);
|
||||
ImGui.SetNextWindowSizeConstraints(this.SizeConstraints.Value.MinimumSize * ImGuiHelpers.GlobalScale, this.SizeConstraints.Value.MaximumSize * ImGuiHelpers.GlobalScale);
|
||||
}
|
||||
|
||||
if (this.BgAlpha.HasValue)
|
||||
|
|
@ -229,5 +224,21 @@ namespace Dalamud.Interface.Windowing
|
|||
ImGui.SetNextWindowBgAlpha(this.BgAlpha.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Structure detailing the size constraints of a window.
|
||||
/// </summary>
|
||||
public struct WindowSizeConstraints
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum size of the window.
|
||||
/// </summary>
|
||||
public Vector2 MinimumSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum size of the window.
|
||||
/// </summary>
|
||||
public Vector2 MaximumSize { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue