Browse Source
Merge pull request #11020 from AvaloniaUI/fixes/direction-degrees
DropShadowEffect Direction is in degrees, not radians
pull/11024/head
Nikita Tsukanov
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
5 deletions
-
src/Avalonia.Base/Media/Effects/DropShadowEffect.cs
-
src/Avalonia.Base/Media/Effects/IDropShadowEffect.cs
|
|
|
@ -18,7 +18,7 @@ public abstract class DropShadowEffectBase : Effect |
|
|
|
} |
|
|
|
|
|
|
|
public static readonly StyledProperty<Color> ColorProperty = AvaloniaProperty.Register<DropShadowEffectBase, Color>( |
|
|
|
nameof(Color)); |
|
|
|
nameof(Color), Colors.Black); |
|
|
|
|
|
|
|
public Color Color |
|
|
|
{ |
|
|
|
@ -97,8 +97,8 @@ public class DropShadowDirectionEffect : DropShadowEffectBase, IDirectionDropSha |
|
|
|
set => SetValue(DirectionProperty, value); |
|
|
|
} |
|
|
|
|
|
|
|
public double OffsetX => Math.Cos(Direction) * ShadowDepth; |
|
|
|
public double OffsetY => Math.Sin(Direction) * ShadowDepth; |
|
|
|
public double OffsetX => Math.Cos(Direction * Math.PI / 180) * ShadowDepth; |
|
|
|
public double OffsetY => Math.Sin(Direction * Math.PI / 180) * ShadowDepth; |
|
|
|
|
|
|
|
public IImmutableEffect ToImmutable() => new ImmutableDropShadowDirectionEffect(OffsetX, OffsetY, BlurRadius, Color, Opacity); |
|
|
|
} |
|
|
|
@ -67,8 +67,8 @@ public class ImmutableDropShadowDirectionEffect : IDirectionDropShadowEffect, II |
|
|
|
Opacity = opacity; |
|
|
|
} |
|
|
|
|
|
|
|
public double OffsetX => Math.Cos(Direction) * ShadowDepth; |
|
|
|
public double OffsetY => Math.Sin(Direction) * ShadowDepth; |
|
|
|
public double OffsetX => Math.Cos(Direction * Math.PI / 180) * ShadowDepth; |
|
|
|
public double OffsetY => Math.Sin(Direction * Math.PI / 180) * ShadowDepth; |
|
|
|
public double Direction { get; } |
|
|
|
public double ShadowDepth { get; } |
|
|
|
public double BlurRadius { get; } |
|
|
|
|