From 7b765b77852d61a41bc9e8db2d3877b5049955ce Mon Sep 17 00:00:00 2001 From: LJQ Date: Sun, 9 Jun 2024 13:03:07 +0800 Subject: [PATCH] Update Enum --- src/controllers/lyrics.js | 18 +++++++++--------- src/controllers/lyrics.types.ts | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/controllers/lyrics.js b/src/controllers/lyrics.js index 29246973f3..c362c4949f 100644 --- a/src/controllers/lyrics.js +++ b/src/controllers/lyrics.js @@ -14,14 +14,14 @@ import LibraryMenu from '../scripts/libraryMenu'; import Events from '../utils/events.ts'; import '../styles/lyrics.scss'; -import { AutoScrollType } from './lyrics.types'; +import { AutoScroll } from './lyrics.types'; let currentPlayer; let currentItem; let savedLyrics; let isDynamicLyric = false; -let autoScroll = AutoScrollType.Instant; +let autoScroll = AutoScroll.Instant; function dynamicLyricHtmlReducer(htmlAccumulator, lyric, index) { if (layoutManager.tv) { @@ -74,11 +74,11 @@ export default function (view) { if (lyric) { lyric.classList.remove('pastLyric'); lyric.classList.remove('futureLyric'); - if (autoScroll !== AutoScrollType.NoScroll) { + if (autoScroll !== AutoScroll.NoScroll) { // instant scroll is used when the view is first loaded - scrollManager.scrollToElement(lyric, autoScroll === AutoScrollType.Smooth); + scrollManager.scrollToElement(lyric, autoScroll === AutoScroll.Smooth); focusManager.focus(lyric); - autoScroll = AutoScrollType.Smooth; + autoScroll = AutoScroll.Smooth; } } } @@ -189,7 +189,7 @@ export default function (view) { } function onLyricClick(lyricTime) { - autoScroll = AutoScrollType.Smooth; + autoScroll = AutoScroll.Smooth; playbackManager.seek(lyricTime); if (playbackManager.paused()) { playbackManager.playPause(currentPlayer); @@ -247,19 +247,19 @@ export default function (view) { } function onWheelOrTouchMove() { - autoScroll = AutoScrollType.NoScroll; + autoScroll = AutoScroll.NoScroll; } function onKeyDown(e) { const key = keyboardNavigation.getKeyName(e); if (key === 'ArrowUp' || key === 'ArrowDown') { - autoScroll = AutoScrollType.NoScroll; + autoScroll = AutoScroll.NoScroll; } } view.addEventListener('viewshow', function () { Events.on(playbackManager, 'playerchange', onPlayerChange); - autoScroll = AutoScrollType.Instant; + autoScroll = AutoScroll.Instant; document.addEventListener('wheel', onWheelOrTouchMove); document.addEventListener('touchmove', onWheelOrTouchMove); document.addEventListener('keydown', onKeyDown); diff --git a/src/controllers/lyrics.types.ts b/src/controllers/lyrics.types.ts index d3b23b93d8..b0870fe124 100644 --- a/src/controllers/lyrics.types.ts +++ b/src/controllers/lyrics.types.ts @@ -1,4 +1,4 @@ -export enum AutoScrollType { +export enum AutoScroll { NoScroll = 0, Smooth = 1, Instant = 2