diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs index f862c94..f539b1d 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs @@ -78,9 +78,9 @@ namespace BetterLyrics.WinUI3.Logic line.ScaleTransition.SetDelay(yScrollDelay); line.ScaleTransition.StartTransition(_highlightedScale - distanceFactor * (_highlightedScale - _defaultScale)); - line.UnplayedOriginalOpacityTransition.SetDuration(yScrollDuration); - line.UnplayedOriginalOpacityTransition.SetDelay(yScrollDelay); - line.UnplayedOriginalOpacityTransition.StartTransition(absLineCountDelta == 0 ? 0.6 : (isMouseScrolling ? 0.3 : (1 - distanceFactor) * 0.3)); + line.PhoneticOpacityTransition.SetDuration(yScrollDuration); + line.PhoneticOpacityTransition.SetDelay(yScrollDelay); + line.PhoneticOpacityTransition.StartTransition(absLineCountDelta == 0 ? 0.6 : (isMouseScrolling ? 0.3 : (1 - distanceFactor) * 0.3)); line.PlayedOriginalOpacityTransition.SetDuration(yScrollDuration); line.PlayedOriginalOpacityTransition.SetDelay(yScrollDelay); diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml.cs index 5789229..929ba05 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/NowPlayingPage.xaml.cs @@ -654,6 +654,61 @@ namespace BetterLyrics.WinUI3.Views UpdateAlbumArtCornerRadius(); } + private void LyricsScrollViewer_PointerWheelChanged(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) + { + LyricsCanvas.IsMouseScrolling = true; + + var pointerPoint = e.GetCurrentPoint(LyricsScrollViewer); + int mouseWheelDelta = pointerPoint.Properties.MouseWheelDelta; + + var value = LyricsCanvas.MouseScrollOffset + mouseWheelDelta; + // 阻止向上滚动超过歌词最大边界 + if (value > 0) + { + value = Math.Min(-LyricsCanvas.CurrentCanvasYScroll, value); + } + // 阻止向下滚动超过歌词最大边界 + else + { + value = Math.Max(-LyricsCanvas.CurrentCanvasYScroll - LyricsCanvas.ActualLyricsHeight, value); + } + LyricsCanvas.MouseScrollOffset = value; + + _scrollChangedTimer.Debounce(() => + { + LyricsCanvas.MouseScrollOffset = 0; + LyricsCanvas.IsMouseScrolling = false; + }, TimeSpan.FromSeconds(3)); + } + + private void LyricsScrollViewer_PointerMoved(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) + { + var pointerPoint = e.GetCurrentPoint(LyricsScrollViewer); + + LyricsCanvas.MousePosition = pointerPoint.Position; + } + + private void LyricsScrollViewer_PointerReleased(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) + { + LyricsCanvas.IsMousePressing = false; + _mediaSessionsService.ChangeLyricsLine(LyricsCanvas.CurrentHoveringLineIndex); + } + + private void LyricsScrollViewer_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) + { + LyricsCanvas.IsMouseInLyricsArea = false; + } + + private void LyricsScrollViewer_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) + { + LyricsCanvas.IsMouseInLyricsArea = true; + } + + private void LyricsScrollViewer_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) + { + LyricsCanvas.IsMousePressing = true; + } + // ==== public void Receive(PropertyChangedMessage message) @@ -782,60 +837,5 @@ namespace BetterLyrics.WinUI3.Views } } } - - private void LyricsScrollViewer_PointerWheelChanged(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) - { - LyricsCanvas.IsMouseScrolling = true; - - var pointerPoint = e.GetCurrentPoint(LyricsScrollViewer); - int mouseWheelDelta = pointerPoint.Properties.MouseWheelDelta; - - var value = LyricsCanvas.MouseScrollOffset + mouseWheelDelta; - // 阻止向上滚动超过歌词最大边界 - if (value > 0) - { - value = Math.Min(-LyricsCanvas.CurrentCanvasYScroll, value); - } - // 阻止向下滚动超过歌词最大边界 - else - { - value = Math.Max(-LyricsCanvas.CurrentCanvasYScroll - LyricsCanvas.ActualLyricsHeight, value); - } - LyricsCanvas.MouseScrollOffset = value; - - _scrollChangedTimer.Debounce(() => - { - LyricsCanvas.MouseScrollOffset = 0; - LyricsCanvas.IsMouseScrolling = false; - }, TimeSpan.FromSeconds(3)); - } - - private void LyricsScrollViewer_PointerMoved(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) - { - var pointerPoint = e.GetCurrentPoint(LyricsScrollViewer); - - LyricsCanvas.MousePosition = pointerPoint.Position; - } - - private void LyricsScrollViewer_PointerReleased(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) - { - LyricsCanvas.IsMousePressing = false; - _mediaSessionsService.ChangeLyricsLine(LyricsCanvas.CurrentHoveringLineIndex); - } - - private void LyricsScrollViewer_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) - { - LyricsCanvas.IsMouseInLyricsArea = false; - } - - private void LyricsScrollViewer_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) - { - LyricsCanvas.IsMouseInLyricsArea = true; - } - - private void LyricsScrollViewer_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) - { - LyricsCanvas.IsMousePressing = true; - } } }