mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 10:54:55 +08:00
fix: phonetic opacity
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<int> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user