feat: reverse gradient direction.

This commit is contained in:
Dong Bin
2025-02-07 23:04:42 +08:00
parent 440ab112e9
commit 5db3e854c8

View File

@@ -2,9 +2,14 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters" xmlns:converters="clr-namespace:Ursa.Themes.Semi.Converters"
xmlns:u="clr-namespace:Ursa.Controls;assembly=Ursa" xmlns:iri="https://irihi.tech/shared"
xmlns:iri="https://irihi.tech/shared"> xmlns:u="clr-namespace:Ursa.Controls;assembly=Ursa">
<!-- Add Resources Here --> <!-- Add Resources Here -->
<Design.PreviewWith>
<StackPanel Margin="20">
<u:LoadingIcon Classes="Large"/>
</StackPanel>
</Design.PreviewWith>
<converters:BrushToColorConverter x:Key="BrushToColorConverter" /> <converters:BrushToColorConverter x:Key="BrushToColorConverter" />
<ControlTheme x:Key="{x:Type u:LoadingIcon}" TargetType="u:LoadingIcon"> <ControlTheme x:Key="{x:Type u:LoadingIcon}" TargetType="u:LoadingIcon">
<Setter Property="IsLoading" Value="True" /> <Setter Property="IsLoading" Value="True" />
@@ -14,19 +19,19 @@
<Arc <Arc
Name="PART_Arc" Name="PART_Arc"
Width="20" Width="20"
IsVisible="{TemplateBinding IsVisible}"
Height="20" Height="20"
IsVisible="{TemplateBinding IsVisible}"
StartAngle="0" StartAngle="0"
StrokeJoin="Round" StrokeJoin="Round"
StrokeLineCap="Round" StrokeLineCap="Round"
StrokeThickness="3" StrokeThickness="3"
SweepAngle="300"> SweepAngle="300">
<Arc.Stroke> <Arc.Stroke>
<ConicGradientBrush Angle="70"> <ConicGradientBrush Angle="50">
<GradientStops> <GradientStops>
<GradientStop Offset="0" Color="{Binding Foreground, Converter={StaticResource BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" /> <GradientStop Offset="0.4" Color="Transparent" />
<GradientStop Offset="0.2" Color="{Binding Foreground, Converter={StaticResource BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" /> <GradientStop Offset="0.8" Color="{Binding Foreground, Converter={StaticResource BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
<GradientStop Offset="0.6" Color="Transparent" /> <GradientStop Offset="1.0" Color="{Binding Foreground, Converter={StaticResource BrushToColorConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
</GradientStops> </GradientStops>
</ConicGradientBrush> </ConicGradientBrush>
</Arc.Stroke> </Arc.Stroke>
@@ -70,8 +75,8 @@
<iri:PureRectangle <iri:PureRectangle
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="True" Background="{TemplateBinding Background}"
Background="{TemplateBinding Background}" /> IsHitTestVisible="True" />
<Grid <Grid
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -92,7 +97,7 @@
<ControlTheme x:Key="{x:Type u:LoadingContainer}" TargetType="u:LoadingContainer"> <ControlTheme x:Key="{x:Type u:LoadingContainer}" TargetType="u:LoadingContainer">
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="MessageForeground" Value="{DynamicResource TextBlockDefaultForeground}"/> <Setter Property="MessageForeground" Value="{DynamicResource TextBlockDefaultForeground}" />
<Setter Property="Background" Value="{DynamicResource LoadingMaskBackground}" /> <Setter Property="Background" Value="{DynamicResource LoadingMaskBackground}" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Indicator"> <Setter Property="Indicator">
@@ -111,9 +116,9 @@
ContentTemplate="{TemplateBinding ContentTemplate}" /> ContentTemplate="{TemplateBinding ContentTemplate}" />
<u:Loading <u:Loading
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
Foreground="{TemplateBinding MessageForeground}"
Content="{TemplateBinding LoadingMessage}" Content="{TemplateBinding LoadingMessage}"
ContentTemplate="{TemplateBinding LoadingMessageTemplate}" ContentTemplate="{TemplateBinding LoadingMessageTemplate}"
Foreground="{TemplateBinding MessageForeground}"
Indicator="{TemplateBinding Indicator}" Indicator="{TemplateBinding Indicator}"
IsLoading="{TemplateBinding IsLoading}" /> IsLoading="{TemplateBinding IsLoading}" />
</Panel> </Panel>