The window height and width variable type is changed from double to int
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

This commit is contained in:
2dust 2025-07-02 20:53:53 +08:00
parent 7a9ee6e9e2
commit 4141f451b7
5 changed files with 21 additions and 15 deletions

View file

@ -2198,8 +2198,18 @@ public class ConfigHandler
config.UiItem.WindowSizeItem.Add(sizeItem); config.UiItem.WindowSizeItem.Add(sizeItem);
} }
sizeItem.Width = width; sizeItem.Width = (int)width;
sizeItem.Height = height; sizeItem.Height = (int)height;
return 0;
}
public static int SaveMainGirdHeight(Config config, double height1, double height2)
{
var uiItem = config.UiItem ?? new();
uiItem.MainGirdHeight1 = (int)(height1 + 0.1);
uiItem.MainGirdHeight2 = (int)(height2 + 0.1);
return 0; return 0;
} }

View file

@ -89,8 +89,8 @@ public class UIItem
{ {
public bool EnableAutoAdjustMainLvColWidth { get; set; } public bool EnableAutoAdjustMainLvColWidth { get; set; }
public bool EnableUpdateSubOnlyRemarksExist { get; set; } public bool EnableUpdateSubOnlyRemarksExist { get; set; }
public double MainGirdHeight1 { get; set; } public int MainGirdHeight1 { get; set; }
public double MainGirdHeight2 { get; set; } public int MainGirdHeight2 { get; set; }
public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical; public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical;
public string? ColorPrimaryName { get; set; } public string? ColorPrimaryName { get; set; }
public string? CurrentTheme { get; set; } public string? CurrentTheme { get; set; }
@ -250,6 +250,6 @@ public class Fragment4RayItem
public class WindowSizeItem public class WindowSizeItem
{ {
public string TypeName { get; set; } public string TypeName { get; set; }
public double Width { get; set; } public int Width { get; set; }
public double Height { get; set; } public int Height { get; set; }
} }

View file

@ -30,7 +30,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
Height = sizeItem.Height; Height = sizeItem.Height;
var workingArea = (Screens.ScreenFromWindow(this) ?? Screens.Primary).WorkingArea; var workingArea = (Screens.ScreenFromWindow(this) ?? Screens.Primary).WorkingArea;
var scaling = VisualRoot is not null ? VisualRoot.RenderScaling : 1.0; var scaling = VisualRoot?.RenderScaling ?? 1.0;
var x = workingArea.X + ((workingArea.Width - (Width * scaling)) / 2); var x = workingArea.X + ((workingArea.Width - (Width * scaling)) / 2);
var y = workingArea.Y + ((workingArea.Height - (Height * scaling)) / 2); var y = workingArea.Y + ((workingArea.Height - (Height * scaling)) / 2);

View file

@ -464,13 +464,11 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal) if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
{ {
_config.UiItem.MainGirdHeight1 = Math.Ceiling(gridMain.ColumnDefinitions[0].ActualWidth + 0.1); ConfigHandler.SaveMainGirdHeight(_config, gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth);
_config.UiItem.MainGirdHeight2 = Math.Ceiling(gridMain.ColumnDefinitions[2].ActualWidth + 0.1);
} }
else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical) else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical)
{ {
_config.UiItem.MainGirdHeight1 = Math.Ceiling(gridMain1.RowDefinitions[0].ActualHeight + 0.1); ConfigHandler.SaveMainGirdHeight(_config, gridMain1.RowDefinitions[0].ActualHeight, gridMain1.RowDefinitions[2].ActualHeight);
_config.UiItem.MainGirdHeight2 = Math.Ceiling(gridMain1.RowDefinitions[2].ActualHeight + 0.1);
} }
} }

View file

@ -423,13 +423,11 @@ public partial class MainWindow
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal) if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
{ {
_config.UiItem.MainGirdHeight1 = Math.Ceiling(gridMain.ColumnDefinitions[0].ActualWidth + 0.1); ConfigHandler.SaveMainGirdHeight(_config, gridMain.ColumnDefinitions[0].ActualWidth, gridMain.ColumnDefinitions[2].ActualWidth);
_config.UiItem.MainGirdHeight2 = Math.Ceiling(gridMain.ColumnDefinitions[2].ActualWidth + 0.1);
} }
else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical) else if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Vertical)
{ {
_config.UiItem.MainGirdHeight1 = Math.Ceiling(gridMain1.RowDefinitions[0].ActualHeight + 0.1); ConfigHandler.SaveMainGirdHeight(_config, gridMain1.RowDefinitions[0].ActualHeight, gridMain1.RowDefinitions[2].ActualHeight);
_config.UiItem.MainGirdHeight2 = Math.Ceiling(gridMain1.RowDefinitions[2].ActualHeight + 0.1);
} }
} }