修复歌词调整时间显示问题
parent
65ae08add6
commit
6de84d3b9b
|
@ -52,6 +52,9 @@ export default {
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const setting = useRefGetter('setting')
|
const setting = useRefGetter('setting')
|
||||||
|
const isZoomActiveLrc = computed(() => setting.value.playDetail.isZoomActiveLrc)
|
||||||
|
const isShowLyricProgressSetting = computed(() => setting.value.playDetail.isShowLyricProgressSetting)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
dom_lyric,
|
dom_lyric,
|
||||||
dom_lyric_text,
|
dom_lyric_text,
|
||||||
|
@ -64,7 +67,7 @@ export default {
|
||||||
handleSkipPlay,
|
handleSkipPlay,
|
||||||
handleSkipMouseEnter,
|
handleSkipMouseEnter,
|
||||||
handleSkipMouseLeave,
|
handleSkipMouseLeave,
|
||||||
} = useLyric({ isPlay, lyric })
|
} = useLyric({ isPlay, lyric, isShowLyricProgressSetting })
|
||||||
|
|
||||||
const lyricMenuVisible = ref(false)
|
const lyricMenuVisible = ref(false)
|
||||||
const lyricMenuXY = reactive({
|
const lyricMenuXY = reactive({
|
||||||
|
@ -111,8 +114,6 @@ export default {
|
||||||
'--playDetail-lrc-font-size': (isShowPlayComment.value ? size * 0.82 : size) + 'rem',
|
'--playDetail-lrc-font-size': (isShowPlayComment.value ? size * 0.82 : size) + 'rem',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const isZoomActiveLrc = computed(() => setting.value.playDetail.isZoomActiveLrc)
|
|
||||||
const isShowLyricProgressSetting = computed(() => setting.value.playDetail.isShowLyricProgressSetting)
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.eventHub.on(eventPlayerNames.updateLyric, updateMusicInfo)
|
window.eventHub.on(eventPlayerNames.updateLyric, updateMusicInfo)
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ref, onMounted, onBeforeUnmount, watch, nextTick } from '@renderer/util
|
||||||
import { scrollTo, throttle, formatPlayTime2 } from '@renderer/utils'
|
import { scrollTo, throttle, formatPlayTime2 } from '@renderer/utils'
|
||||||
import { player as eventPlayerNames } from '@renderer/event/names'
|
import { player as eventPlayerNames } from '@renderer/event/names'
|
||||||
|
|
||||||
export default ({ isPlay, lyric }) => {
|
export default ({ isPlay, lyric, isShowLyricProgressSetting }) => {
|
||||||
const dom_lyric = ref(null)
|
const dom_lyric = ref(null)
|
||||||
const dom_lyric_text = ref(null)
|
const dom_lyric_text = ref(null)
|
||||||
const dom_skip_line = ref(null)
|
const dom_skip_line = ref(null)
|
||||||
|
@ -40,13 +40,11 @@ export default ({ isPlay, lyric }) => {
|
||||||
startLyricScrollTimeout()
|
startLyricScrollTimeout()
|
||||||
}
|
}
|
||||||
|
|
||||||
const setTime = throttle(() => {
|
const throttleSetTime = throttle(() => {
|
||||||
if (point.x == null) {
|
if (!dom_skip_line.value) return
|
||||||
if (!dom_skip_line.value) return
|
const rect = dom_skip_line.value.getBoundingClientRect()
|
||||||
const rect = dom_skip_line.value.getBoundingClientRect()
|
point.x = rect.x
|
||||||
point.x = rect.x
|
point.y = rect.y
|
||||||
point.y = rect.y
|
|
||||||
}
|
|
||||||
let dom = document.elementFromPoint(point.x, point.y)
|
let dom = document.elementFromPoint(point.x, point.y)
|
||||||
if (dom_pre_line === dom) return
|
if (dom_pre_line === dom) return
|
||||||
if (dom.tagName == 'SPAN') {
|
if (dom.tagName == 'SPAN') {
|
||||||
|
@ -70,6 +68,9 @@ export default ({ isPlay, lyric }) => {
|
||||||
}
|
}
|
||||||
dom_pre_line = dom
|
dom_pre_line = dom
|
||||||
})
|
})
|
||||||
|
const setTime = () => {
|
||||||
|
if (isShowLyricProgressSetting.value) throttleSetTime()
|
||||||
|
}
|
||||||
|
|
||||||
const handleScrollLrc = (duration = 300) => {
|
const handleScrollLrc = (duration = 300) => {
|
||||||
if (!dom_lines?.length || !dom_lyric.value) return
|
if (!dom_lines?.length || !dom_lyric.value) return
|
||||||
|
@ -184,14 +185,15 @@ export default ({ isPlay, lyric }) => {
|
||||||
watch(() => lyric.line, scrollLine)
|
watch(() => lyric.line, scrollLine)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
document.addEventListener('mousemove', handleMouseMsMove)
|
||||||
|
document.addEventListener('mouseup', handleMouseMsUp)
|
||||||
|
|
||||||
initLrc(lyric.lines, null)
|
initLrc(lyric.lines, null)
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
scrollLine(lyric.line)
|
scrollLine(lyric.line)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
document.addEventListener('mousemove', handleMouseMsMove)
|
|
||||||
document.addEventListener('mouseup', handleMouseMsUp)
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
document.removeEventListener('mousemove', handleMouseMsMove)
|
document.removeEventListener('mousemove', handleMouseMsMove)
|
||||||
document.removeEventListener('mouseup', handleMouseMsUp)
|
document.removeEventListener('mouseup', handleMouseMsUp)
|
||||||
|
|
Loading…
Reference in New Issue