mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
fix: playlist cards use RouterLink for reliable navigation, lyrics use scrollTo for smooth sync
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ee5a75ab5e
commit
ce6fc92780
2 files changed
+23
-9
No files matched your search
@@ -110,9 +110,20 @@ function findActiveLine(elapsed: number): number {
|
||||
|
||||
function scrollToActiveLine(idx: number) {
|
||||
const el = lineRefs.value[idx];
|
||||
if (el && scrollContainer.value) {
|
||||
el.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
const container = scrollContainer.value;
|
||||
if (!el || !container) return;
|
||||
|
||||
// Calculate target scroll position to center the active line
|
||||
const containerHeight = container.clientHeight;
|
||||
const lineTop = el.offsetTop;
|
||||
const lineHeight = el.offsetHeight;
|
||||
const targetScroll = lineTop - containerHeight / 2 + lineHeight / 2;
|
||||
|
||||
// Smooth scroll using CSS scroll-behavior or manual animation
|
||||
container.scrollTo({
|
||||
top: targetScroll,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
|
||||
function syncLyrics() {
|
||||
|
||||
Reference in new issue
Block a user