Skip to content

Commit a200ada

Browse files
authored
Merge pull request #1352 from Flow-Launcher/rounded-icon-mask-field
Rounded icon mask field
2 parents 6a37074 + bd1499b commit a200ada

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Flow.Launcher.Plugin/Result.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public string IcoPath
6666
}
6767
}
6868
}
69+
/// <summary>
70+
/// Determines if Icon has a border radius
71+
/// </summary>
72+
public bool RoundedIcon { get; set; } = false;
6973

7074
/// <summary>
7175
/// Delegate function, see <see cref="Icon"/>

Flow.Launcher/ResultListBox.xaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,17 @@
8282
BorderThickness="0">
8383
<Image
8484
x:Name="ImageIcon"
85-
Width="32"
86-
Height="32"
85+
Width="{Binding IconXY}"
86+
Height="{Binding IconXY}"
8787
Margin="0,0,0,0"
8888
HorizontalAlignment="Center"
8989
Source="{Binding Image, TargetNullValue={x:Null}}"
9090
Stretch="Uniform"
91-
Visibility="{Binding ShowIcon}" />
91+
Visibility="{Binding ShowIcon}">
92+
<Image.Clip>
93+
<EllipseGeometry RadiusX="{Binding IconRadius}" RadiusY="{Binding IconRadius}" Center="16 16"/>
94+
</Image.Clip>
95+
</Image>
9296
</Border>
9397
<Border
9498
Margin="9,0,0,0"

Flow.Launcher/ViewModel/ResultViewModel.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ public Visibility ShowIcon
8484
}
8585
}
8686

87+
public double IconRadius
88+
{
89+
get
90+
{
91+
if (Result.RoundedIcon)
92+
{
93+
return IconXY / 2;
94+
}
95+
return IconXY;
96+
}
97+
98+
}
99+
87100
public Visibility ShowGlyph
88101
{
89102
get
@@ -175,6 +188,8 @@ public int ResultProgress
175188

176189
public string QuerySuggestionText { get; set; }
177190

191+
public double IconXY { get; set; } = 32;
192+
178193
public override bool Equals(object obj)
179194
{
180195
return obj is ResultViewModel r && Result.Equals(r.Result);

0 commit comments

Comments
 (0)