diff options
author | Aubrey Li <Aubrey-Li> | 2021-10-26 17:16:16 -0400 |
---|---|---|
committer | Aubrey Li <Aubrey-Li> | 2021-10-26 17:16:16 -0400 |
commit | 34ce1ba0275406aff180a49f99d333ffa0d86e3b (patch) | |
tree | 25e8ae29b145e5e1e33c59e285f3b29f5a481dc5 /src/client/util/DragManager.ts | |
parent | 3c1b393732ef9dc704a2f40b103c37b3f8370ba7 (diff) | |
parent | 48d5e650ddc8caa8252561bbc91961f2f4677d6e (diff) |
Merge branch 'master' into trails-aubrey
Diffstat (limited to 'src/client/util/DragManager.ts')
-rw-r--r-- | src/client/util/DragManager.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts index 421e4c6bb..f5704d2bf 100644 --- a/src/client/util/DragManager.ts +++ b/src/client/util/DragManager.ts @@ -365,6 +365,21 @@ export namespace DragManager { const dragElements = eles.map(ele => { if (!ele.parentNode) dragDiv.appendChild(ele); const dragElement = ele.parentNode === dragDiv ? ele : ele.cloneNode(true) as HTMLElement; + const children = Array.from(dragElement.children); + while (children.length) { // need to replace all the maker node reference ids with new unique ids. otherwise, the clone nodes will reference the original nodes which are all hidden during the drag + const next = children.pop(); + next && children.push(...Array.from(next.children)); + if (next) { + ["marker-start", "marker-mid", "marker-end"].forEach(field => { + if (next.localName.startsWith("path") && (next.attributes as any)[field]) { + next.setAttribute(field, (next.attributes as any)[field].value.replace("#", "#X")); + } + }); + if (next.localName.startsWith("marker")) { + next.id = "X" + next.id; + } + } + } const rect = ele.getBoundingClientRect(); const scaleX = rect.width / ele.offsetWidth; const scaleY = ele.offsetHeight ? rect.height / ele.offsetHeight : scaleX; |