Bläddra i källkod

Merge branch 'hqyDevNewVersion' of http://git.dayaedu.com/liushengqiang/music-score into feature-tianyong-newVersion

TIANYONG 11 månader sedan
förälder
incheckning
0de373fb48

+ 20 - 6
src/page-instrument/simple-detail/index.tsx

@@ -1,5 +1,5 @@
 import { defineComponent, onMounted, onUnmounted, reactive, nextTick } from "vue";
-import state, { getMusicDetail, handleSetSpeed, addNoteBBox, getNote, gotoNext, fillWordColor } from "/src/state";
+import state, { getMusicDetail, handleSetSpeed, addNoteBBox, getNote, gotoNext, fillWordColor, moveSvgDom } from "/src/state";
 import MusicScore from "../../view/music-score";
 import styles from "./index.module.less";
 import { getQuery } from "/src/utils/queryString";
@@ -44,18 +44,32 @@ export default defineComponent({
 			if (resInfo?.api === "api_updateProgress") {
 				console.log('拖动的进度')
 				if (state.playState === 'paused') {
-					detailData.currentTime = resInfo?.content?.currentTime ? resInfo?.content?.currentTime : detailData.currentTime;
+					detailData.currentTime = resInfo?.content?.currentTime ?? detailData.currentTime;
+					// 坐标和小节都改为初始值
+					state.activeNoteIndex = 0
+					state.activeMeasureIndex = state.times[0].MeasureNumberXML;
 					handlePlaying(true);
 				}
 			}
 			// 播放进度
 			if (resInfo?.api === "api_playProgress") {
 				// console.log('播放进度',resInfo)
-				if (resInfo?.content?.currentTime) {
-					if (resInfo?.content?.currentTime < detailData.currentTime) {
+				const currentTime = resInfo?.content?.currentTime
+				if (currentTime) {
+					if (currentTime < detailData.currentTime) {
+						// 坐标和小节都改为初始值
 						state.activeNoteIndex = 0
+						let item = getNote(currentTime) || state.times[0];
+						if(item.i === state.activeNoteIndex){
+							state.activeMeasureIndex = item.MeasureNumberXML;
+						}
+						// 当拖动到MP3节拍器时候 需要手动移动到当前为止
+						const fixtime = state.times[0].fixtime
+						if(currentTime <= fixtime){
+							moveSvgDom(true)
+						}
 					}
-					detailData.currentTime = resInfo?.content?.currentTime
+					detailData.currentTime = currentTime
 				}
 			}
 		};
@@ -134,7 +148,7 @@ export default defineComponent({
 			//detailData.currentTime += 0.03
 			const currentTime = detailData.currentTime;
 			// console.log('👀~播放进度',currentTime)
-			let item = getNote(currentTime);
+			let item = getNote(currentTime) || state.times[0];
 			if (item) {
 				gotoNext(item, skipNote);
 			}

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

@@ -87,6 +87,7 @@ export const musicScoreRef = ref();
 export default defineComponent({
   name: "music-list",
   setup() {
+    const browsInfo = browser();
     const query: any = getQuery();
 
     const detailData = reactive({
@@ -105,7 +106,8 @@ export default defineComponent({
         // console.log("🚀 ~ screenData:", screenData.content);
         const { isSpecialShapedScreen, notchHeight } = screenData.content;
         if (isSpecialShapedScreen) {
-          detailData.paddingLeft = 25 + "px";
+          // 安卓取刘海值
+          detailData.paddingLeft = browsInfo.android ? notchHeight : 26 + "px";
         }
       }
     };
@@ -411,7 +413,6 @@ export default defineComponent({
         }
       }
     );
-    const browsInfo = browser();
     const handleOpenFignerView = () => {
       if (!query.modelType) {
         detailData.orientation = state.fingeringInfo.orientation || 0;

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

@@ -464,7 +464,8 @@ function createSmoothCurvePoints(pointsPos: pointsPosType, tension?: number, clo
  */
 function drawSmoothCurve(context: CanvasRenderingContext2D, pointsPos: pointsPosType, progresspointsPos?: pointsPosType) {
    context.lineWidth = 4
-   context.lineJoin = "round" // 优化锯齿
+   context.lineJoin = 'round';// 优化锯齿
+   context.lineCap = 'round'; // 优化锯齿
    context.strokeStyle = "rgba(255,255,255,0.6)"
    drawLines(context, pointsPos)
    if (progresspointsPos?.length) {

+ 2 - 2
src/state.ts

@@ -382,7 +382,7 @@ const state = reactive({
   /** 激活的note index */
   activeNoteIndex: 0,
   /** 激活的小节 */
-  activeMeasureIndex: 0,
+  activeMeasureIndex: -1,
   /** 选段状态 */
   sectionStatus: false,
   /** 选段数据 */
@@ -1859,7 +1859,7 @@ watch(
 /** 刷新谱面 */
 export const refreshMusicSvg = () => {
   resetBaseRate();
-  state.activeMeasureIndex = 0;
+  state.activeMeasureIndex = -1;
   // 销毁旋律线
   destroySmoothAnimation()
   musicScoreRef.value?.refreshMusicScore()

+ 1 - 1
src/view/music-score/index.tsx

@@ -117,7 +117,7 @@ export default defineComponent({
 			if (state.isSimplePage) {
 				osmd.EngravingRules.PageTopMargin = state.musicRenderType === 'staff' ? 0 : 3;
 				osmd.EngravingRules.PageTopMarginNarrow = 0;
-				osmd.EngravingRules.PageLeftMargin = 0;
+				osmd.EngravingRules.PageLeftMargin = 1;
 				osmd.EngravingRules.PageRightMargin = 0;
 				osmd.EngravingRules.BreathMarkDistance = 0.1; 
 				osmd.EngravingRules.PageBottomMargin = 0;