|
@@ -176,7 +176,7 @@ export const filterMoveData = async () => {
|
|
|
const noteIdx = computedDistance(elementX, elementY);
|
|
|
// 此元素距离最近音符的x轴,y轴距离
|
|
|
const noteRelativeX = elementX - moveData.noteCoords[noteIdx]?.x, noteRelativeY = elementY - moveData.noteCoords[noteIdx]?.y;
|
|
|
- const item: any = {
|
|
|
+ let item: any = {
|
|
|
id: n.id,
|
|
|
isMove: n.isMove,
|
|
|
isDelete: n.isDelete,
|
|
@@ -194,6 +194,11 @@ export const filterMoveData = async () => {
|
|
|
if (n.type === "vf-lineGroup") {
|
|
|
item.dx = n.dx;
|
|
|
}
|
|
|
+ if (n.id.includes('text')) {
|
|
|
+ // let copyDom = document.querySelector("#" + n.id)!.cloneNode(true) as SVGSVGElement
|
|
|
+ const textContent = document.querySelector("#" + n.id)?.querySelector("text")?.innerHTML || ''
|
|
|
+ item.textContent = textContent
|
|
|
+ }
|
|
|
return item;
|
|
|
});
|
|
|
// if (!list.length) {
|
|
@@ -472,7 +477,23 @@ export const renderForMoveData = () => {
|
|
|
nextTick(() => {
|
|
|
console.log("🚀 ~ list", list);
|
|
|
list.forEach((item: any) => {
|
|
|
- const index = moveData.modelList.findIndex((n: any) => n.id === item.id);
|
|
|
+ let index = moveData.modelList.findIndex((n: any) => n.id === item.id);
|
|
|
+ if (item.type === 'vf-text' && item.textContent) {
|
|
|
+ let textValue = document.querySelector("#" + moveData.modelList[index].id)?.querySelector("text")?.innerHTML || ''
|
|
|
+ let targetIndex = index, preEnd = false;
|
|
|
+ while (textValue !== item.textContent) {
|
|
|
+ if (preEnd) {
|
|
|
+ targetIndex = targetIndex + 1
|
|
|
+ } else {
|
|
|
+ targetIndex = targetIndex > 0 ? targetIndex - 1 : targetIndex
|
|
|
+ }
|
|
|
+ if (targetIndex == 0) preEnd = true
|
|
|
+ textValue = document.querySelector("#" + moveData.modelList[targetIndex].id)?.querySelector("text")?.innerHTML || ''
|
|
|
+ }
|
|
|
+ index = targetIndex + 1
|
|
|
+ item.id = `text${index}`
|
|
|
+ }
|
|
|
+ console.log(66666666,index)
|
|
|
if (index > -1) {
|
|
|
moveData.modelList[index] = {
|
|
|
...moveData.modelList[index],
|