respositionning node (fixed)

graph
Fabien Benetou 1 year ago
parent d7884f0f0c
commit e82e8db66c
  1. 5
      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...
})
})
}

Loading…
Cancel
Save