|
@@ -294,7 +294,7 @@ const renderSvgItem = (item: any) => {
|
|
|
};
|
|
|
|
|
|
/** 设置元素位置 */
|
|
|
-function setModelPostion(item: any, x: number, y: number) {
|
|
|
+async function setModelPostion(item: any, x: number, y: number) {
|
|
|
// console.log(item)
|
|
|
if (item) {
|
|
|
const g = document.querySelector("#" + item.id)!; // svg元素
|
|
@@ -310,6 +310,9 @@ function setModelPostion(item: any, x: number, y: number) {
|
|
|
// tsY = item.yRem * clientWidth/10
|
|
|
// }
|
|
|
if (item.noteIdx >= 0) {
|
|
|
+ if (!moveData.noteCoords.length) {
|
|
|
+ await initNoteCoord()
|
|
|
+ }
|
|
|
const targetX = moveData.noteCoords[item.noteIdx].x + item.noteRelativeX, targetY = moveData.noteCoords[item.noteIdx].y + item.noteRelativeY;
|
|
|
const original = document.getElementById(item.id)?.getBoundingClientRect() || { x: 0, y: 0 };
|
|
|
tsX = targetX - original.x;
|