Skip to content

Commit

Permalink
要素を選択したときの透明度のアニメーションを無効化
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Aug 6, 2023
1 parent 1f99b06 commit 42c8687
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions src/Beutl/Views/ElementView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,29 +472,6 @@ private sealed class _SelectBehavior : Behavior<ElementView>
{
private bool _pressedWithModifier;
private Thickness _snapshot;
private static readonly Avalonia.Animation.Animation s_animation1 = new()
{
Duration = TimeSpan.FromSeconds(0.083),
Children =
{
new KeyFrame
{
Cue = new Cue(0),
Setters =
{
new Setter(OpacityProperty, 1d),
}
},
new KeyFrame
{
Cue = new Cue(1),
Setters =
{
new Setter(OpacityProperty, 0.8),
}
}
}
};

protected override void OnAttached()
{
Expand Down Expand Up @@ -540,7 +517,7 @@ private void OnPointerReleased(object? sender, PointerReleasedEventArgs e)
}
}

private async void OnBorderPointerPressed(object? sender, PointerPressedEventArgs e)
private void OnBorderPointerPressed(object? sender, PointerPressedEventArgs e)
{
if (AssociatedObject is { _timeline: { } } obj)
{
Expand All @@ -555,9 +532,6 @@ private async void OnBorderPointerPressed(object? sender, PointerPressedEventArg
}
else
{
s_animation1.PlaybackDirection = PlaybackDirection.Normal;
Task task1 = s_animation1.RunAsync(obj.border);

if (e.KeyModifiers is KeyModifiers.None or KeyModifiers.Alt)
{
EditViewModel editorContext = obj._timeline.ViewModel.EditorContext;
Expand All @@ -572,14 +546,13 @@ private async void OnBorderPointerPressed(object? sender, PointerPressedEventArg
_pressedWithModifier = true;
}

await task1;
obj.border.Opacity = 0.8;
}
}
}
}

private async void OnBorderPointerReleased(object? sender, PointerReleasedEventArgs e)
private void OnBorderPointerReleased(object? sender, PointerReleasedEventArgs e)
{
if (AssociatedObject is { _timeline: { } } obj)
{
Expand All @@ -596,8 +569,6 @@ private async void OnBorderPointerReleased(object? sender, PointerReleasedEventA
_pressedWithModifier = false;
}

s_animation1.PlaybackDirection = PlaybackDirection.Reverse;
await s_animation1.RunAsync(obj.border);
obj.border.Opacity = 1;
}
}
Expand Down

0 comments on commit 42c8687

Please sign in to comment.