|
@@ -595,6 +595,8 @@ const state = reactive({
|
|
|
headTopHeight: 0,
|
|
|
/** 是否是自动重播,练习模式开启自动重播时,播放前不需要再次计算播放倍率了,还是按照上次的播放倍率播放音频 */
|
|
|
isAutoRePlay: false,
|
|
|
+ /** 跟练,是否收到了录音的回调 */
|
|
|
+ hasFollowResult: false,
|
|
|
});
|
|
|
const browserInfo = browser();
|
|
|
let offset_duration = 0;
|
|
@@ -639,7 +641,9 @@ export const onPlay = () => {
|
|
|
/** 播放模式结束自动重播 */
|
|
|
const autoResetPlay = () => {
|
|
|
if (state.modeType !== "practise") return;
|
|
|
- skipNotePlay(0, true);
|
|
|
+ // 如果是选段需要跳转到预备小节或者选段内的第一小节,否则跳转到第一小节
|
|
|
+ const targetIdx = state.section.length === 2 ? state.sectionFirst?.i || state.section[1].i : 0;
|
|
|
+ skipNotePlay(targetIdx, true);
|
|
|
// 没有开启自动重播, 不是练习模式
|
|
|
if (!state.setting.repeatAutoPlay) return;
|
|
|
offsetTop = 0;
|
|
@@ -1356,7 +1360,7 @@ export const hanldeDirectSelection = (list: any[]) => {
|
|
|
console.log('选段小节', state.section)
|
|
|
}, 0);
|
|
|
};
|
|
|
-let offsetTop = 0;
|
|
|
+let offsetTop = 0, musicScrollTop = 0;
|
|
|
/**
|
|
|
* 窗口内滚动到音符的区域
|
|
|
* @param isScroll 可选: 强制滚动到顶部, 默认: false
|
|
@@ -1368,24 +1372,34 @@ export const scrollViewNote = (resetTop?: boolean) => {
|
|
|
return;
|
|
|
}
|
|
|
const noteId = state.times[state.activeNoteIndex].id;
|
|
|
- if (!noteId) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (!noteId) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
const domId = "vf" + noteId;
|
|
|
- const cursorElement: any = document.querySelector(`[data-vf=${domId}]`)?.parentElement;
|
|
|
+ // 合并休止小节没有音符,取小节的位置,否则取音符指针位置
|
|
|
+ const cursorElement: any = !noteId && state.times[state.activeNoteIndex]?.totalMultipleRestMeasures ? document.querySelector(`.measureIndex_${state.activeMeasureIndex}`) : document.querySelector(`[data-vf=${domId}]`)?.parentElement;
|
|
|
const musicAndSelection = document.getElementById(state.scrollContainer)!;
|
|
|
if (!state.headTopHeight) {
|
|
|
state.headTopHeight = document.querySelector('.headHeight')?.getBoundingClientRect()?.height || 100;
|
|
|
}
|
|
|
- // console.log('滑动',cursorElement.offsetTop,offsetTop, cursorElement, )
|
|
|
- if (!cursorElement || !musicAndSelection || offsetTop === cursorElement.offsetTop || Math.abs(offsetTop - cursorElement.offsetTop) < 30) return;
|
|
|
+ // console.log('滑动',musicAndSelection?.scrollTop, musicScrollTop)
|
|
|
+ if (!cursorElement || !musicAndSelection) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (Math.abs(musicAndSelection?.scrollTop - musicScrollTop) > 30) {
|
|
|
+ // 手动滑动谱面,重新播放需要滚动到对应位置
|
|
|
+ } else {
|
|
|
+ if (offsetTop === cursorElement.offsetTop || Math.abs(offsetTop - cursorElement.offsetTop) < 30) return;
|
|
|
+ }
|
|
|
offsetTop = cursorElement.offsetTop;
|
|
|
if (offsetTop > (state.headTopHeight + 30)) {
|
|
|
+ musicScrollTop = (offsetTop - state.headTopHeight - 30) * state.musicZoom
|
|
|
musicAndSelection.scrollTo({
|
|
|
top: (offsetTop - state.headTopHeight - 30) * state.musicZoom,
|
|
|
behavior: "smooth",
|
|
|
});
|
|
|
} else {
|
|
|
+ musicScrollTop = 0
|
|
|
musicAndSelection.scrollTo({
|
|
|
top: 0,
|
|
|
behavior: "smooth",
|