Explorar el Código

fix: 多行滚动问题修改

TIANYONG hace 10 meses
padre
commit
351793aee4
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      src/state.ts

+ 6 - 1
src/state.ts

@@ -1274,7 +1274,12 @@ let offsetTop = 0;
  */
 export const scrollViewNote = () => {
   // const cursorElement = document.getElementById("cursorImg-0")!;
-  const cursorElement: any = document.querySelector(`.noteIndex_${state.activeNoteIndex}`)!;
+  const noteId = state.times[state.activeNoteIndex].id;
+  if (!noteId) {
+    return;
+  }
+  const domId = "vf" + noteId;
+  const cursorElement: any = document.querySelector(`[data-vf=${domId}]`)?.parentElement;
   const musicAndSelection = document.getElementById(state.scrollContainer)!;
   // console.log('滑动',cursorElement.offsetTop,offsetTop, cursorElement, )
   if (!cursorElement || !musicAndSelection || offsetTop === cursorElement.offsetTop || Math.abs(offsetTop - cursorElement.offsetTop) < 30) return;