mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Default Minimum/Maximum WindowSizeConstraints (#1574)
* feat: Default Minimum/Maximum WindowSizeConstraints If `MinimumSize` or `MaximumSize` are not set when defining a `WindowSizeConstraints`, they will be effectively unbounded. * chore: Make internal windows unbounded on max size * Ignore max value if it's smaller than minimum in any dimension
This commit is contained in:
parent
e21b64969f
commit
c19e1f0fcd
4 changed files with 26 additions and 6 deletions
|
|
@ -71,7 +71,6 @@ internal class ConsoleWindow : Window, IDisposable
|
|||
this.SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(600.0f, 200.0f),
|
||||
MaximumSize = new Vector2(9999.0f, 9999.0f),
|
||||
};
|
||||
|
||||
this.RespectCloseHotkey = false;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = this.Size.Value,
|
||||
MaximumSize = new Vector2(5000, 5000),
|
||||
};
|
||||
|
||||
Service<PluginManager>.GetAsync().ContinueWith(pluginManagerTask =>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ public class StyleEditorWindow : Window
|
|||
this.SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(890, 560),
|
||||
MaximumSize = new Vector2(10000, 10000),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -623,15 +623,38 @@ public abstract class Window
|
|||
/// </summary>
|
||||
public struct WindowSizeConstraints
|
||||
{
|
||||
private Vector2 internalMaxSize = new(float.MaxValue);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WindowSizeConstraints"/> struct.
|
||||
/// </summary>
|
||||
public WindowSizeConstraints()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum size of the window.
|
||||
/// </summary>
|
||||
public Vector2 MinimumSize { get; set; }
|
||||
|
||||
public Vector2 MinimumSize { get; set; } = new(0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum size of the window.
|
||||
/// </summary>
|
||||
public Vector2 MaximumSize { get; set; }
|
||||
public Vector2 MaximumSize
|
||||
{
|
||||
get => this.GetSafeMaxSize();
|
||||
set => this.internalMaxSize = value;
|
||||
}
|
||||
|
||||
private Vector2 GetSafeMaxSize()
|
||||
{
|
||||
var currentMin = this.MinimumSize;
|
||||
|
||||
if (this.internalMaxSize.X < currentMin.X || this.internalMaxSize.Y < currentMin.Y)
|
||||
return new Vector2(float.MaxValue);
|
||||
|
||||
return this.internalMaxSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue