Estoy creando un editor donde los nodos (grupos de dojo) están conectados entre sí a través de enlaces (líneas de dojo). Al mover estos nodos usando applyTransform(matrix), el nodo se mueve correctamente pero toda la línea se mueve de acuerdo con la transformación. Lo que quiero es que solo el punto conectado al nodo se mueva con él y que el otro punto se quede donde está.
Tengo un motor personalizado que debería mover el nodo y el punto de línea conectado
dojo.declare("customMover", dojox.gfx.Mover, { onMouseMove: function(event) { let transform = this.shape.getTransform(); if (transform==null) { transform = { dx: 0, dy: 0 }; } let x = event.clientX; let y = event.clientY; this.shape.applyLeftTransform({ dx: x - this.lastX, dy: y - this.lastY }); this.shape.bonds.forEach(bond => { console.log(bond) for (let nodeIndex = 0; nodeIndex < bond.nodes.length; nodeIndex++) { let node = bond.nodes[nodeIndex]; if (node === this.shape) { // do something to change 1 point of the line } } }) this.lastX = x; this.lastY = y; dojo.stopEvent(event); } })y una función que crea líneas entre dos nodos.
export function createLine(start, end, group) { let startMat = null; let endMat = null; let startNode = start.getParent() let endNode = end.getParent() if (startNode.matrix) { startMat = startNode.matrix } if (endNode.matrix) { endMat = endNode.matrix } let line = group.createLine({ x1: startMat ? start.shape.cx + startMat.dx : start.shape.cx, y1: startMat ? start.shape.cy + startMat.dy : start.shape.cy, x2: endMat ? end.shape.cx + endMat.dx : end.shape.cx, y2: endMat ? end.shape.cy + endMat.dy : end.shape.cy}) line.moveToBack() line.setStroke({}) line.nodes = [startNode, endNode] startNode.bonds.push(line) endNode.bonds.push(line) }¿Cómo podría cambiar un punto de la línea?