Implement temporary result list height increase when preview is on

This commit is contained in:
Yusyuriv 2024-05-30 20:49:36 +06:00
parent de8c8bde76
commit 29be504789
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
2 changed files with 34 additions and 5 deletions

View file

@ -143,15 +143,21 @@ namespace Flow.Launcher.ViewModel
ContextMenu = new ResultsViewModel(Settings)
{
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
LeftClickResultCommand = OpenResultCommand,
RightClickResultCommand = LoadContextMenuCommand,
IsPreviewOn = Settings.AlwaysPreview
};
Results = new ResultsViewModel(Settings)
{
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
LeftClickResultCommand = OpenResultCommand,
RightClickResultCommand = LoadContextMenuCommand,
IsPreviewOn = Settings.AlwaysPreview
};
History = new ResultsViewModel(Settings)
{
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
LeftClickResultCommand = OpenResultCommand,
RightClickResultCommand = LoadContextMenuCommand,
IsPreviewOn = Settings.AlwaysPreview
};
_selectedResults = Results;
@ -586,6 +592,10 @@ namespace Flow.Launcher.ViewModel
{
HidePreview();
}
ContextMenu.IsPreviewOn = PreviewVisible;
History.IsPreviewOn = PreviewVisible;
Results.IsPreviewOn = PreviewVisible;
}
private void ShowPreview()

View file

@ -1,4 +1,5 @@
using Flow.Launcher.Infrastructure.UserSettings;
using System;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using System.Collections.Generic;
using System.Collections.Specialized;
@ -49,7 +50,25 @@ namespace Flow.Launcher.ViewModel
#region Properties
public double MaxHeight => MaxResults * _settings.ItemHeightSize;
public bool IsPreviewOn { get; set; }
public double MaxHeight
{
get
{
var newResultsCount = MaxResults;
if (IsPreviewOn)
{
newResultsCount = (int)Math.Ceiling(380 / _settings.ItemHeightSize);
if (newResultsCount < MaxResults)
{
newResultsCount = MaxResults;
}
}
return newResultsCount * _settings.ItemHeightSize;
}
}
public double ItemHeightSize
{
get => _settings.ItemHeightSize;