Merge pull request #1352 from Flow-Launcher/rounded-icon-mask-field

Rounded icon mask field
This commit is contained in:
Jeremy Wu 2022-10-03 14:19:55 +11:00 committed by GitHub
commit a200adaa9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 3 deletions

View file

@ -66,6 +66,10 @@ namespace Flow.Launcher.Plugin
}
}
}
/// <summary>
/// Determines if Icon has a border radius
/// </summary>
public bool RoundedIcon { get; set; } = false;
/// <summary>
/// Delegate function, see <see cref="Icon"/>

View file

@ -82,13 +82,17 @@
BorderThickness="0">
<Image
x:Name="ImageIcon"
Width="32"
Height="32"
Width="{Binding IconXY}"
Height="{Binding IconXY}"
Margin="0,0,0,0"
HorizontalAlignment="Center"
Source="{Binding Image, TargetNullValue={x:Null}}"
Stretch="Uniform"
Visibility="{Binding ShowIcon}" />
Visibility="{Binding ShowIcon}">
<Image.Clip>
<EllipseGeometry RadiusX="{Binding IconRadius}" RadiusY="{Binding IconRadius}" Center="16 16"/>
</Image.Clip>
</Image>
</Border>
<Border
Margin="9,0,0,0"

View file

@ -84,6 +84,19 @@ namespace Flow.Launcher.ViewModel
}
}
public double IconRadius
{
get
{
if (Result.RoundedIcon)
{
return IconXY / 2;
}
return IconXY;
}
}
public Visibility ShowGlyph
{
get
@ -175,6 +188,8 @@ namespace Flow.Launcher.ViewModel
public string QuerySuggestionText { get; set; }
public double IconXY { get; set; } = 32;
public override bool Equals(object obj)
{
return obj is ResultViewModel r && Result.Equals(r.Result);