黄琪勇 hai 1 ano
pai
achega
4958160e7a
Modificáronse 1 ficheiros con 11 adicións e 1 borrados
  1. 11 1
      src/page-instrument/view-detail/smoothAnimation/index.ts

+ 11 - 1
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -113,6 +113,10 @@ export function destroySmoothAnimation() {
  * 根据播放时间进度移动处理
  */
 export function moveSmoothAnimationByPlayTime() {
+   // 暂停之后不进行移动了
+   if (state.playState === "paused") {
+      return
+   }
    const currentTime = getAudioCurrentTime()
    if (currentTime <= state.fixtime) return
    if (currentTime > state.times.last()?.endtime) return
@@ -172,7 +176,7 @@ export function moveSmoothAnimation(progress: number, activeIndex: number) {
    )
    // 当移动到屏幕最右边时候 就不进行移动了
    if (
-      (smoothAnimationState.osdmScrollDom?.scrollLeft || 0) + smoothAnimationState.translateXNum + smoothAnimationState.osdmScrollDomWith >
+      (smoothAnimationState.osdmScrollDom?.scrollLeft || 0) + smoothAnimationState.translateXNum + smoothAnimationState.osdmScrollDomWith >=
       smoothAnimationState.canvasDomWith
    ) {
       return
@@ -231,6 +235,12 @@ function move_osmd(nowPointsPos: pointsPosType[0]) {
    } else if (midBotNum > clientMidWidth + clientWidth * 0.45 && midBotNum <= clientMidWidth + clientWidth * 0.5) {
       smoothAnimationState.translateXNum += speed * 5
    }
+   // 最多移动的位置
+   const maxTranslateXNum =
+      smoothAnimationState.canvasDomWith - smoothAnimationState.osdmScrollDomWith - (smoothAnimationState.osdmScrollDom?.scrollLeft || 0)
+   if (smoothAnimationState.translateXNum > maxTranslateXNum) {
+      smoothAnimationState.translateXNum = maxTranslateXNum
+   }
    moveTranslateXNum(smoothAnimationState.translateXNum)
 }