Pārlūkot izejas kodu

优化单行谱切换到五线谱,再切到评测再切到练习模式 小鸟位置不对

黄琪勇 1 gadu atpakaļ
vecāks
revīzija
14554059b5

+ 0 - 17
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -104,11 +104,6 @@ export function destroySmoothAnimation() {
       aveSpeed: 0,
       clientWidth: 0
    })
-   Object.assign(moveState, {
-      oldIndex: -1,
-      progress: 0,
-      activeIndex: 0
-   })
 }
 
 /**
@@ -143,14 +138,7 @@ export function moveSmoothAnimationByPlayTime(time?: number) {
  * progress  当前音符到下一个音符的距离百分比
  * activeIndex 当前
  */
-const moveState = {
-   oldIndex: -1, // 上一次index
-   progress: 0,
-   activeIndex: 0
-}
 export function moveSmoothAnimation(progress: number, activeIndex: number, isMoveOsmd = true) {
-   moveState.progress = progress
-   moveState.activeIndex = activeIndex
    // if (!smoothAnimationState.isShow.value) {
    //    return
    // }
@@ -160,11 +148,6 @@ export function moveSmoothAnimation(progress: number, activeIndex: number, isMov
    const progressCalcIndex = Math.round(progress * _numberOfSegments)
    // // 当前的index
    let nowIndex = nextPointsIndex - _numberOfSegments + progressCalcIndex
-   // 当前计算的位置和上一次值一样时候不运行
-   if (moveState.oldIndex === nowIndex) {
-      return
-   }
-   moveState.oldIndex = nowIndex
    const nowPointsPos = smoothAnimationState.pointsPos[nowIndex]
    smoothAnimationState.canvasCtx?.clearRect(0, 0, smoothAnimationState.canvasDomWith, smoothAnimationState.canvasDomHeight)
    // 移动