|
@@ -626,6 +626,7 @@ const autoResetPlay = () => {
|
|
|
skipNotePlay(0, true);
|
|
|
// 没有开启自动重播, 不是练习模式
|
|
|
if (!state.setting.repeatAutoPlay) return;
|
|
|
+ offsetTop = 0;
|
|
|
scrollViewNote();
|
|
|
setTimeout(() => {
|
|
|
togglePlay("play");
|
|
@@ -817,6 +818,10 @@ export const togglePlay = async (playState: "play" | "paused", isForceCLoseToast
|
|
|
console.log("设置音源")
|
|
|
changeSongSourceByBeat(metronomeData.disable)
|
|
|
}
|
|
|
+ if (playState === 'play') {
|
|
|
+ offsetTop = 0;
|
|
|
+ scrollViewNote();
|
|
|
+ }
|
|
|
// midi播放
|
|
|
if (state.isAppPlay) {
|
|
|
if (playState === "paused") {
|
|
@@ -1293,14 +1298,18 @@ let offsetTop = 0;
|
|
|
export const scrollViewNote = () => {
|
|
|
// const cursorElement = document.getElementById("cursorImg-0")!;
|
|
|
const noteId = state.times[state.activeNoteIndex].id;
|
|
|
- if (!noteId || state.isSingleLine) {
|
|
|
+ if (state.isSingleLine) {
|
|
|
return;
|
|
|
}
|
|
|
+ if (state.activeNoteIndex <= 1) {
|
|
|
+ offsetTop = 0;
|
|
|
+ }
|
|
|
const domId = "vf" + noteId;
|
|
|
- const cursorElement: any = document.querySelector(`[data-vf=${domId}]`)?.parentElement;
|
|
|
+ const cursorElement: any = noteId ? document.querySelector(`[data-vf=${domId}]`)?.parentElement : document.getElementById('restDot')?.parentElement;
|
|
|
const musicAndSelection = document.getElementById(state.scrollContainer)!;
|
|
|
+ // offsetTop = musicAndSelection.scrollTop || offsetTop;
|
|
|
const noteCenterOffsetTop = cursorElement ? cursorElement?.offsetTop + (cursorElement?.offsetHeight/2) : 0;
|
|
|
- // console.log('滑动',cursorElement.offsetTop,offsetTop, cursorElement, )
|
|
|
+ // console.log('滑动',offsetTop, noteCenterOffsetTop)
|
|
|
if (!cursorElement || !noteCenterOffsetTop || !musicAndSelection || offsetTop === noteCenterOffsetTop || Math.abs(offsetTop - noteCenterOffsetTop) < 30) return;
|
|
|
offsetTop = noteCenterOffsetTop;
|
|
|
if (offsetTop > 100) {
|