|
@@ -8,7 +8,7 @@ import { IFingering, mappingVoicePart, subjectFingering, matchVoicePart } from "
|
|
|
import { handleStartTick, closeTick } from "./view/tick";
|
|
|
import { audioListStart, getAudioCurrentTime, getAudioDuration, setAudioCurrentTime, setAudioPlaybackRate, audioData } from "./view/audio-list";
|
|
|
import { toggleFollow } from "./view/follow-practice";
|
|
|
-import { browser, setStorageSpeed, setGlobalData, checkDecimal } from "./utils";
|
|
|
+import { browser, setStorageSpeed, setGlobalData, checkDecimal, getNumbers } from "./utils";
|
|
|
import { api_cloudGetMediaStatus, api_createMusicPlayer, api_cloudChangeSpeed, api_cloudSuspend, api_cloudSetCurrentTime, api_cloudDestroy } from "./helpers/communication";
|
|
|
import { verifyCanRepeat, getDuration, xmlAddPartName } from "./helpers/formateMusic";
|
|
|
import { getMusicSheetDetail, getInstrumentCode } from "./utils/baseApi"
|
|
@@ -382,6 +382,8 @@ const state = reactive({
|
|
|
xmlFromStore: false,
|
|
|
/** 是否是自定义的note时值 */
|
|
|
isCustomNoteTime: false,
|
|
|
+ /** 中英文歌词是否需要同时高亮 */
|
|
|
+ isTogetherHeighLight: false,
|
|
|
});
|
|
|
const browserInfo = browser();
|
|
|
let offset_duration = 0;
|
|
@@ -1143,7 +1145,11 @@ export const scrollViewNote = (resetTop?: boolean) => {
|
|
|
}
|
|
|
const domId = "vf" + noteId;
|
|
|
// 合并休止小节没有音符,取小节的位置,否则取音符指针位置
|
|
|
- const cursorElement: any = !noteId && state.times[state.activeNoteIndex]?.totalMultipleRestMeasures ? document.querySelector(`.measureIndex_${state.activeMeasureIndex}`) : document.querySelector(`[data-vf=${domId}]`)?.parentElement;
|
|
|
+ let cursorElement: any = !noteId && state.times[state.activeNoteIndex]?.totalMultipleRestMeasures ? document.querySelector(`.measureIndex_${state.activeMeasureIndex}`) : document.querySelector(`[data-vf=${domId}]`)?.parentElement;
|
|
|
+ // 如果是简谱
|
|
|
+ if (state.musicRenderType === EnumMusicRenderType.firstTone || state.musicRenderType === EnumMusicRenderType.fixedTone) {
|
|
|
+ // cursorElement = cursorElement.querySelector('.node-dot')
|
|
|
+ }
|
|
|
const musicAndSelection = document.getElementById(state.scrollContainer)!;
|
|
|
if (!state.headTopHeight) {
|
|
|
state.headTopHeight = document.querySelector('.headHeight')?.getBoundingClientRect()?.height || 100;
|
|
@@ -1160,7 +1166,7 @@ export const scrollViewNote = (resetTop?: boolean) => {
|
|
|
if (offsetTop === cursorElement.offsetTop || Math.abs(offsetTop - cursorElement.offsetTop) < 30) return;
|
|
|
}
|
|
|
// offsetTop = noteCenterOffsetTop;
|
|
|
- offsetTop = cursorElement.offsetTop;
|
|
|
+ offsetTop = state.musicRenderType === EnumMusicRenderType.staff ? cursorElement.offsetTop : cursorElement.getBoundingClientRect().height/2 + cursorElement.offsetTop;
|
|
|
const animateType = browser().android ? "instant" : "smooth"
|
|
|
if (offsetTop > (state.headTopHeight + 30)) {
|
|
|
musicScrollTop = (offsetTop - state.headTopHeight - 30) * state.musicZoom
|
|
@@ -1939,12 +1945,21 @@ export const fillWordColor = () => {
|
|
|
})
|
|
|
const currentLyrics: SVGAElement[] = Array.from(document.querySelectorAll(`.lyric${currentNote?.noteId}`));
|
|
|
currentLyrics.forEach((lyric, index) => {
|
|
|
- const lyricIndex = lyric.getAttribute('lyricIndex');
|
|
|
+ let lyricIndex = lyric.getAttribute('lyricIndex');
|
|
|
// bug:#10942,如果需要反复唱的小节,只有一遍歌词,反复唱的时候,歌词都需要高亮
|
|
|
const onlyOneLyric = currentNote.measures?.every((item: any) => item?.formatLyricsEntries?.length <= 1);
|
|
|
- if ((index === currentNote.repeatIdx && currentNote.repeatIdx + 1 == lyricIndex) || (currentNote.repeatIdx != index && !onlyOneLyric && currentNote.repeatIdx + 1 == lyricIndex) || (currentNote.repeatIdx > 0 && currentNote.formatLyricsEntries?.length === 1 && onlyOneLyric)) {
|
|
|
- lyric?.classList.add('lyricActive')
|
|
|
- }
|
|
|
+
|
|
|
+ // 中英文歌词同时高亮
|
|
|
+ if (state.isTogetherHeighLight) {
|
|
|
+ let multiIdxs = getNumbers(currentNote.repeatIdx+1)
|
|
|
+ if ((index === currentNote.repeatIdx && multiIdxs.includes(Number(lyricIndex)) ) || (currentNote.repeatIdx != index && !onlyOneLyric && multiIdxs.includes(Number(lyricIndex)) ) || (currentNote.repeatIdx > 0 && currentNote.formatLyricsEntries?.length === 1 && onlyOneLyric)) {
|
|
|
+ lyric?.classList.add('lyricActive')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ((index === currentNote.repeatIdx && currentNote.repeatIdx + 1 == lyricIndex) || (currentNote.repeatIdx != index && !onlyOneLyric && currentNote.repeatIdx + 1 == lyricIndex) || (currentNote.repeatIdx > 0 && currentNote.formatLyricsEntries?.length === 1 && onlyOneLyric)) {
|
|
|
+ lyric?.classList.add('lyricActive')
|
|
|
+ }
|
|
|
+ }
|
|
|
// bug: #11189,兼容处理需要唱4遍,但是只打了2遍歌词的情况,1、3唱一样的歌词,2、4唱一样的歌词
|
|
|
if ( currentNote.formatLyricsEntries.length == 2 && currentNote.repeatIdx >= 2 && index === (currentNote.repeatIdx - 2) ) {
|
|
|
lyric?.classList.add('lyricActive')
|