aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DragManager.ts
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2021-10-07 16:47:27 -0400
committermehekj <mehek.jethani@gmail.com>2021-10-07 16:47:27 -0400
commit11571a4db8907467b1a17d8fe14c80a9e47c6030 (patch)
treeea1cadecb241ad881332c8f953594633c8cf785c /src/client/util/DragManager.ts
parente7d41738198931dd54dc4ce0b74ee2654ba10bbd (diff)
parent662176f25e25d3bf31cfb8ec6e3792d18f77f37d (diff)
Merge branch 'master' into temporalmedia-mehek
Diffstat (limited to 'src/client/util/DragManager.ts')
-rw-r--r--src/client/util/DragManager.ts15
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;