* 判断歌词是否需要滚动到可视区域 * @param {HTMLElement} activeLine - 活跃的歌词行 * @returns {boolean}
(activeLine)
| 525 | * @returns {boolean} |
| 526 | */ |
| 527 | shouldScrollLyricIntoView(activeLine) { |
| 528 | if (!this.dom.lyricsContainer) return true; |
| 529 | |
| 530 | const containerRect = this.dom.lyricsContainer.getBoundingClientRect(); |
| 531 | const lineRect = activeLine.getBoundingClientRect(); |
| 532 | const topThreshold = containerRect.top + containerRect.height * this.config.UI.LYRIC_SCROLL_THRESHOLD; |
| 533 | const bottomThreshold = containerRect.bottom - containerRect.height * this.config.UI.LYRIC_SCROLL_THRESHOLD; |
| 534 | |
| 535 | return lineRect.top < topThreshold || lineRect.bottom > bottomThreshold; |
| 536 | } |
| 537 | |
| 538 | // ========================================================================= |
| 539 | // 单句循环 |
no outgoing calls
no test coverage detected