Code quality & Fix

This commit is contained in:
Jack251970 2025-03-29 15:38:44 +08:00
parent 91c5e84ca0
commit 10d43875ea
2 changed files with 17 additions and 10 deletions

View file

@ -10,7 +10,7 @@
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
Name="FlowMainWindow"
Title="Flow Launcher"
Width="{Binding MainWindowWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Width="{Binding MainWindowWidth, Mode=OneWay}"
MinWidth="400"
MinHeight="30"
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"

View file

@ -455,23 +455,25 @@ namespace Flow.Launcher
{
_initialWidth = (int)Width;
_initialHeight = (int)Height;
handled = true;
}
else if (msg == Win32Helper.WM_EXITSIZEMOVE)
{
if (_initialHeight != (int)Height)
{
var shadowMargin = 0;
var (_, useDropShadowEffect) = _theme.GetActualValue();
if (useDropShadowEffect)
{
shadowMargin = 32;
}
if (!_settings.KeepMaxResults)
{
var itemCount = (Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize;
// Get shadow margin
var shadowMargin = 0;
var (_, useDropShadowEffect) = _theme.GetActualValue();
if (useDropShadowEffect)
{
shadowMargin = 32;
}
// Calculate max results to show
var itemCount = (Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize;
if (itemCount < 2)
{
_settings.MaxResultsToShow = 2;
@ -483,11 +485,16 @@ namespace Flow.Launcher
}
SizeToContent = SizeToContent.Height;
_viewModel.MainWindowWidth = Width;
}
if (_initialWidth != (int)Width)
{
if (!_settings.KeepMaxResults)
{
// Update width
_viewModel.MainWindowWidth = Width;
}
SizeToContent = SizeToContent.Height;
}