jgraph icon indicating copy to clipboard operation
jgraph copied to clipboard

Multiple edges between nodes

Open d0znpp opened this issue 9 years ago • 3 comments

Do you have plans to implement multiple edges between nodes? Right now new edge will overwrite previous. And this this looks like one edge. mesh = new THREE.Mesh(self.cylinderGeometry, material); Looks like we can bend cylinder

d0znpp avatar Jul 09 '16 03:07 d0znpp

Could you clarify? Do you mean multiple edges connecting the same two nodes, like:

screen shot 2016-07-09 at 9 39 16 am

patrickfuller avatar Jul 09 '16 14:07 patrickfuller

Yes.

d0znpp avatar Jul 09 '16 20:07 d0znpp

I'm probably not going to implement that any time soon - haven't been doing much work on this project. However, it should be easy enough to implement by looping the code. Something like:

deltas = [-0.15, 0.15];
deltas.forEach(function (dy) {
    mesh = new THREE.Mesh(self.cylinderGeometry, material);
    mesh.position.addVectors(n1.position, n2.position).divideScalar(2.0);
    mesh.lookAt(n2.position);
    mesh.translateY(dy);
    mag = n2.position.distanceTo(n1.position);

    if (edge.hasOwnProperty('size')) {
        mesh.scale.set(edge.size, edge.size, mag);
    } else {
        mesh.scale.z = mag;
    }

    // Save array-index references to nodes, mapping from object structure
    mesh.source = map[edge.source.toString()];
    mesh.target = map[edge.target.toString()];
    self.scene.add(mesh);
    self.edges.push(mesh);
});

where this would go where the current edge rendering bit is. It's untested, so it will take some finagling to get running.

patrickfuller avatar Jul 09 '16 21:07 patrickfuller