5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 00:41:59 +08:00

Ensure min/max window sizes are valid

This commit is contained in:
Lea Anthony 2021-04-25 14:52:42 +10:00
parent 97592fad5c
commit dea6d261ad

View File

@ -45,6 +45,28 @@ func MergeDefaults(appoptions *App) {
log.Fatal(err)
}
// Ensure max and min are valid
if appoptions.MinWidth > appoptions.MaxWidth {
appoptions.MinWidth = appoptions.MaxWidth
}
if appoptions.MinHeight > appoptions.MaxHeight {
appoptions.MinHeight = appoptions.MaxHeight
}
// Ensure width and height are limited if max/min is set
if appoptions.Width < appoptions.MinWidth {
appoptions.Width = appoptions.MinWidth
}
if appoptions.Width > appoptions.MaxWidth {
appoptions.Width = appoptions.MaxWidth
}
if appoptions.Height < appoptions.MinHeight {
appoptions.Height = appoptions.MinHeight
}
if appoptions.Height > appoptions.MaxHeight {
appoptions.Height = appoptions.MaxHeight
}
}
func GetTrayMenus(appoptions *App) []*menu.TrayMenu {