MCPcopy Index your code
hub / github.com/iChochy/NCE / shouldScrollLyricIntoView

Method shouldScrollLyricIntoView

js/ReadingSystem.js:527–536  ·  view source on GitHub ↗

* 判断歌词是否需要滚动到可视区域 * @param {HTMLElement} activeLine - 活跃的歌词行 * @returns {boolean}

(activeLine)

Source from the content-addressed store, hash-verified

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 // 单句循环

Callers 1

updateLyricHighlightMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected