Browse Source

一行谱 谱面移动 忽略回退

黄琪勇 5 months ago
parent
commit
c773e0b1b0

+ 1 - 1
src/page-instrument/component/authorName/index.tsx

@@ -14,7 +14,7 @@ export default defineComponent({
       const noticeBarDom = ref()
       const isScroll = ref(false)
       onMounted(() => {
-         const noticeBarEl = noticeBarDom.value.$el
+         const noticeBarEl = noticeBarDom.value?.$el
          if(noticeBarEl){
             isScroll.value = noticeBarEl.querySelector(".van-notice-bar__wrap")?.offsetWidth < noticeBarEl.querySelector(".van-notice-bar__content")?.offsetWidth
          }

+ 1 - 1
src/page-instrument/simple-detail/index.tsx

@@ -165,7 +165,7 @@ export default defineComponent({
 			state.activeNoteIndex = item?.i || 0
 			// 一行谱,需要滚动小节
 			if (state.isSingleLine) {
-				moveSmoothAnimationByPlayTime(currentTime)
+				moveSmoothAnimationByPlayTime(currentTime, true)
 			}
 		
 		};

+ 3 - 2
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -163,15 +163,16 @@ export function destroySmoothAnimation() {
 
 /**
  * 根据播放时间进度移动处理
+ * isIgnoreFilter  忽略这种 判断,因为有些只需要谱面移动
  */
-export function moveSmoothAnimationByPlayTime(time?: number) {
+export function moveSmoothAnimationByPlayTime(time?: number, isIgnoreFilter = false) {
    // 暂停之后不进行移动了
    if (state.playState === "paused") {
       return
    }
    const currentTime = time || getAudioCurrentTime()
    // 某些浏览器 音频暂停后返回的时间会倒退,把这种时间过滤掉
-   if(currentTime < smoothAnimationState.oldCurrentTime) {
+   if(currentTime < smoothAnimationState.oldCurrentTime && !isIgnoreFilter) {
       return
    }
    smoothAnimationState.oldCurrentTime = currentTime