Merge pull request #2738 from onesounds/240529-Fix-SettingWindow-Centering

Fix Setting Window Centering Logic when First Launch
This commit is contained in:
Kevin Zhang 2024-05-30 12:15:29 -07:00 committed by GitHub
commit 85270358ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View file

@ -88,8 +88,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public double SettingWindowWidth { get; set; } = 1000;
public double SettingWindowHeight { get; set; } = 700;
public double SettingWindowTop { get; set; }
public double SettingWindowLeft { get; set; }
public double? SettingWindowTop { get; set; } = null;
public double? SettingWindowLeft { get; set; } = null;
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
public int CustomExplorerIndex { get; set; } = 0;

View file

@ -110,15 +110,15 @@ public partial class SettingWindow
public void InitializePosition()
{
if (_settings.SettingWindowTop == null)
if (_settings.SettingWindowTop == null || _settings.SettingWindowLeft == null)
{
Top = WindowTop();
Left = WindowLeft();
}
else
{
Top = _settings.SettingWindowTop;
Left = _settings.SettingWindowLeft;
Top = _settings.SettingWindowTop.Value;
Left = _settings.SettingWindowLeft.Value;
}
WindowState = _settings.SettingWindowState;
}

View file

@ -52,13 +52,13 @@ public class SettingWindowViewModel : BaseModel
set => Settings.SettingWindowHeight = value;
}
public double SettingWindowTop
public double? SettingWindowTop
{
get => Settings.SettingWindowTop;
set => Settings.SettingWindowTop = value;
}
public double SettingWindowLeft
public double? SettingWindowLeft
{
get => Settings.SettingWindowLeft;
set => Settings.SettingWindowLeft = value;