Explorar el Código

取消,如果没有节拍器,默认提前一个小节

skyblued hace 2 años
padre
commit
d18786a8ba
Se han modificado 2 ficheros con 35 adiciones y 30 borrados
  1. 3 1
      src/pages/detail/runtime.ts
  2. 32 29
      src/pages/detail/section-box/index.tsx

+ 3 - 1
src/pages/detail/runtime.ts

@@ -646,7 +646,9 @@ export const setSectionModeCurrentTime = () => {
   } else {
     const measureListIndex = detailState.section[0].noteElement?.sourceMeasure?.measureListIndex
     if (measureListIndex > 0) {
-      setCurrentTime(getFirsrNoteByMeasureListIndex(measureListIndex - 1).time)
+      // setCurrentTime(getFirsrNoteByMeasureListIndex(measureListIndex - 1).time)
+      // 如果没有节拍器,默认提前一个小节
+      setCurrentTime(getFirsrNoteByMeasureListIndex(measureListIndex).time)
       detailState.sectionFlash = true
     } else {
       setCurrentTime(0)

+ 32 - 29
src/pages/detail/section-box/index.tsx

@@ -122,35 +122,38 @@ export default defineComponent({
         const activeTimeNote = state.times[activeIndex]
         const activeNote = activeTimeNote.noteElement
         const measureListIndex = activeNote.sourceMeasure.measureListIndex
-        if (index === 0 && measureListIndex !== 0 && !state.needTick) {
-          const firstNote = getFirsrNoteByMeasureListIndex(measureListIndex - 1)
-          const fnote = firstNote?.noteElement
-          if (fnote) {
-            // console.log(fnote.sourceMeasure?.measureListIndex, start.noteElement?.sourceMeasure?.measureListIndex)
-            for (
-              let j = fnote.sourceMeasure?.measureListIndex;
-              j < start.noteElement?.sourceMeasure?.measureListIndex;
-              j++
-            ) {
-              if (!seteds.includes(j)) {
-                for (const item of state.times) {
-                  if (item.noteElement?.sourceMeasure?.measureListIndex === j && !seteds.includes(j)) {
-                    const boundingBox = this.getBoundingBoxByNote(item.noteElement, {
-                      before: true,
-                    })
-                    state.befireSection = item
-                    if (!boundingBox) {
-                      continue
-                    }
-                    state.sectionBoundingBoxs.push(boundingBox)
-                    heights.push(boundingBox.height)
-                    seteds.push(j)
-                  }
-                }
-              }
-            }
-          }
-        }
+
+        // 如果没有节拍器,默认提前一个小节
+        // if (index === 0 && measureListIndex !== 0 && !state.needTick) {
+        //   const firstNote = getFirsrNoteByMeasureListIndex(measureListIndex - 1)
+        //   const fnote = firstNote?.noteElement
+        //   if (fnote) {
+        //     // console.log(fnote.sourceMeasure?.measureListIndex, start.noteElement?.sourceMeasure?.measureListIndex)
+        //     for (
+        //       let j = fnote.sourceMeasure?.measureListIndex;
+        //       j < start.noteElement?.sourceMeasure?.measureListIndex;
+        //       j++
+        //     ) {
+        //       if (!seteds.includes(j)) {
+        //         for (const item of state.times) {
+        //           if (item.noteElement?.sourceMeasure?.measureListIndex === j && !seteds.includes(j)) {
+        //             const boundingBox = this.getBoundingBoxByNote(item.noteElement, {
+        //               before: true,
+        //             })
+        //             state.befireSection = item
+        //             if (!boundingBox) {
+        //               continue
+        //             }
+        //             state.sectionBoundingBoxs.push(boundingBox)
+        //             heights.push(boundingBox.height)
+        //             seteds.push(j)
+        //           }
+        //         }
+        //       }
+        //     }
+        //   }
+        // }
+
         if (!seteds.includes(measureListIndex)) {
           seteds.push(measureListIndex)
           const boundingBox = this.getBoundingBoxByNote(activeNote)