Skip to content

Commit 29be504

Browse files
committed
Implement temporary result list height increase when preview is on
1 parent de8c8bd commit 29be504

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,21 @@ public MainViewModel(Settings settings)
143143

144144
ContextMenu = new ResultsViewModel(Settings)
145145
{
146-
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
146+
LeftClickResultCommand = OpenResultCommand,
147+
RightClickResultCommand = LoadContextMenuCommand,
148+
IsPreviewOn = Settings.AlwaysPreview
147149
};
148150
Results = new ResultsViewModel(Settings)
149151
{
150-
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
152+
LeftClickResultCommand = OpenResultCommand,
153+
RightClickResultCommand = LoadContextMenuCommand,
154+
IsPreviewOn = Settings.AlwaysPreview
151155
};
152156
History = new ResultsViewModel(Settings)
153157
{
154-
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
158+
LeftClickResultCommand = OpenResultCommand,
159+
RightClickResultCommand = LoadContextMenuCommand,
160+
IsPreviewOn = Settings.AlwaysPreview
155161
};
156162
_selectedResults = Results;
157163

@@ -586,6 +592,10 @@ public void TogglePreview()
586592
{
587593
HidePreview();
588594
}
595+
596+
ContextMenu.IsPreviewOn = PreviewVisible;
597+
History.IsPreviewOn = PreviewVisible;
598+
Results.IsPreviewOn = PreviewVisible;
589599
}
590600

591601
private void ShowPreview()

Flow.Launcher/ViewModel/ResultsViewModel.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Flow.Launcher.Infrastructure.UserSettings;
1+
using System;
2+
using Flow.Launcher.Infrastructure.UserSettings;
23
using Flow.Launcher.Plugin;
34
using System.Collections.Generic;
45
using System.Collections.Specialized;
@@ -49,7 +50,25 @@ public ResultsViewModel(Settings settings) : this()
4950

5051
#region Properties
5152

52-
public double MaxHeight => MaxResults * _settings.ItemHeightSize;
53+
public bool IsPreviewOn { get; set; }
54+
55+
public double MaxHeight
56+
{
57+
get
58+
{
59+
var newResultsCount = MaxResults;
60+
if (IsPreviewOn)
61+
{
62+
newResultsCount = (int)Math.Ceiling(380 / _settings.ItemHeightSize);
63+
if (newResultsCount < MaxResults)
64+
{
65+
newResultsCount = MaxResults;
66+
}
67+
}
68+
return newResultsCount * _settings.ItemHeightSize;
69+
}
70+
}
71+
5372
public double ItemHeightSize
5473
{
5574
get => _settings.ItemHeightSize;

0 commit comments

Comments
 (0)