|
@@ -347,7 +347,26 @@ const setCursorPosition = (note: any, cursor: any) => {
|
|
|
state.musicRenderType === EnumMusicRenderType.fixedTone
|
|
|
) {
|
|
|
nextTick(() => {
|
|
|
- const bbox = note.bbox;
|
|
|
+ let bbox = note.bbox;
|
|
|
+ if (!bbox) {
|
|
|
+ const musicContainer = document.getElementById("musicAndSelection")?.getBoundingClientRect() || {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ };
|
|
|
+ const parentLeft = musicContainer.x || 0;
|
|
|
+ const noteEle = document.querySelector(`#vf-${note.svgElement?.attrs?.id}`);
|
|
|
+ if (noteEle) {
|
|
|
+ const noteHead = noteEle.querySelector(".vf-numbered-note-head");
|
|
|
+ const noteHeadBbox = noteHead?.getBoundingClientRect?.();
|
|
|
+ if (noteHeadBbox) {
|
|
|
+ note.bbox = {
|
|
|
+ left: noteHeadBbox.x - parentLeft - noteHeadBbox.width / 4,
|
|
|
+ width: noteHeadBbox.width * 1.5,
|
|
|
+ };
|
|
|
+ bbox = note.bbox;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!bbox) return;
|
|
|
const baseW = state.platform === IPlatform.PC ? 29 : 18;
|
|
|
const width = (bbox.width - baseW) / 3;
|