Ver código fonte

Merge branch 'gyt-feature-tianyong' into online

TIANYONG 1 ano atrás
pai
commit
10dd45ed64

+ 36 - 39
src/pages/detail/helpers.ts

@@ -749,34 +749,30 @@ export const setStepIndex = (osmd: any, num: number, prev?: number) => {
 }
 
 export const getIndex = (times: any[], currentTime: Number) => {
-  // console.log(currentTime)
-  if (currentTime > state.times[state.times.length - 1].endtime) {
-    return -1
-  }
-  let index = 0
-  const ftime = times.filter((n, fi) => {
-    const p: any = times[fi - 1]
-    return p?.skipNextNote === false
-  })
-  for (let i = 0; i < ftime.length; i++) {
-    const item = ftime[i]
-    const prevItem = ftime[i - 1]
-    if (currentTime >= item.time) {
-      if (!prevItem || item.time != prevItem.time) {
-        index = item.i
-      }
-    } else {
-      break
-    }
-  }
-  if (state.sectionStatus && state.section.length === 2) {
-    // 限制不超过此范围
-    const startSection = state.befireSection || state.section[0]
-    index = Math.min(Math.max(index, startSection.i), state.section[1].i)
-    // console.log('endIndex', index)
-  }
-  return index
-}
+	// console.log(currentTime)
+	if (currentTime > state.times[state.times.length - 1].endtime) {
+		return state.times.length - 1;
+	}
+	let index = 0;
+	for (let i = 0; i < times.length; i++) {
+		const item = times[i];
+		const prevItem = times[i - 1];
+		if (currentTime >= item.time) {
+			if (!prevItem || item.time != prevItem.time) {
+				index = item.i;
+			}
+		} else {
+			break;
+		}
+	}
+	if (state.sectionStatus && state.section.length === 2) {
+		// 限制不超过此范围
+		const startSection = state.befireSection || state.section[0];
+		index = Math.min(Math.max(index, startSection.i), state.section[1].i);
+		// console.log('endIndex', index)
+	}
+	return index;
+};
 
 export const getSlursNote = (_note: any, pos?: 'start' | 'end') => {
   const note: any =
@@ -847,18 +843,19 @@ export const getNoteByMeasuresSlursStart = (note: any) => {
 }
 
 export const getActtiveNoteByTimes = (evt: MouseEvent) => {
-  const el = (evt.target as HTMLDivElement)?.dataset
-  // console.log(state)
+	const el = (evt.target as HTMLDivElement)?.dataset;
+	// console.log(state)
 
-  const data: any = {}
-  for (const time of state.times) {
-    if (time.id) {
-      data[time.id] = time
-    }
-  }
-  const activeNote = data[el.id || '']
-  return activeNote
-}
+	const data: any = {};
+	for (const time of state.times) {
+		if (time.id && !data[time.id]) {
+			data[time.id] = time;
+		}
+	}
+	const activeNote = data[el.id || ""];
+	// state.timesById = data
+	return activeNote;
+};
 
 const getPrevHasSourceNote = (note: any) => {
   const indexOf = Math.max(state.times.indexOf(note) - 1, 0)

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

@@ -184,6 +184,7 @@ export const setCurrentTime = (time: number) => {
   detailState.fixedKey = 0
   state.currentTimeNum = fixt
   state.currentTime = formatTime(fixt)
+  state.audiosInstance.setCurrentTime(fixt)
   if (detailState.activeDetail.isAppPlay) {
     promisefiyPostMessage({
       api: 'cloudSetCurrentTime',
@@ -668,9 +669,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)
+      // setCurrentTime(getFirsrNoteByMeasureListIndex(measureListIndex).time)
       detailState.sectionFlash = true
     } else {
       setCurrentTime(0)

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

@@ -125,35 +125,35 @@ export default defineComponent({
         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)

+ 7 - 0
src/subpages/colexiu/fingering/index.module.less

@@ -24,6 +24,13 @@
     > div {
       max-width: 60%;
       margin: auto;
+      // img {
+      //   margin: 10px auto;
+      //   height: 100%;
+      //   width: 100% !important;
+      //   max-width: 100% !important;
+      //   max-height: 100% !important;
+      // }
     }
   }
 

+ 1 - 1
src/subpages/colexiu/index.module.less

@@ -23,7 +23,7 @@
 }
 :global(.eyeProtection) {
   :global(.fingering) {
-    background: var(--eye-background-color);
+    // background: var(--eye-background-color);
   }
   .musicSheet {
     background: var(--eye-background-color) !important;

+ 1 - 1
src/subpages/colexiu/index.tsx

@@ -364,7 +364,7 @@ export default defineComponent({
                 paddingBottom:
                   needFingering && (fingeringDetail.value as any).height
                     ? (fingeringDetail.value as any).height
-                    : '60px',
+                    : SettingState.sett.eyeProtection ? '78px' : '60px',
                 background: SettingState.sett.camera
                   ? `rgba(${SettingState.sett.eyeProtection ? '253,244,229' : '255,255,255'} ,${
                       SettingState.sett.opacity / 100