From e82e8db66cae324b2d2211a6fa5e34c762aaffa3 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Mon, 16 Jan 2023 15:32:34 +0100 Subject: [PATCH] respositionning node (fixed) --- index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 5e993bb..7531f9f 100644 --- a/index.html +++ b/index.html @@ -2102,10 +2102,12 @@ AFRAME.registerComponent('update-links-on-pinchended', { let rootEl = document.querySelector("#graphroot") let el = this.el this.el.addEventListener('released', function (event) { + let found_links = 0 Object.keys( rootEl.components ) // get all links .filter( i => i.indexOf(el.id) > -1 ) // keeps links related to the moved node .map( i => { // for each link - let newpos = el.getAttribute("position") + found_links++ + let newpos = AFRAME.utils.coordinates.stringify( el.getAttribute("position") ) let [src,tgt] = i.replace("line__","").split("__to__"); srcpos = AFRAME.utils.coordinates.stringify( rootEl.getAttribute(i).start ) tgtpos = AFRAME.utils.coordinates.stringify( rootEl.getAttribute(i).end ) @@ -2114,7 +2116,6 @@ AFRAME.registerComponent('update-links-on-pinchended', { } else { rootEl.setAttribute(i, { start: srcpos, end: newpos }) } - // somehow works once... }) }) }