freegroup / draw2d

Create Visio like drawings, diagrams or workflows with JavaScript and HTML5
https://freegroup.github.io/draw2d/#/examples
MIT License
734 stars 226 forks source link

How to Use ManhattanConnectionRouter with explicit waypoints #214

Closed RomanoViolet closed 1 year ago

RomanoViolet commented 2 years ago

I am attempting to create a connection between two ports using the ManhattanConnectionRouter. Additionally, I want the specify the waypoints the routing should pass through as an array of x,y points.

I have tried to explicitly populate vertices like so:

let _con = new draw2d.Connection();
_con.setRouter(new draw2d.layout.connection.ManhattanConnectionRouter());
_con.vertices.clear();
_con.vertices.push(/* an array of {x,y} */);

But the line still does not follow the waypoints I specify. I have also tried to use the route( connection, oldVertices, [routingHints] ) method for explicitly specifying waypoints:

_con.route([{x,y}, ...]);

but still the routing does not honor the waypoints.

What am I doing wrong?

freegroup commented 1 year ago

it is not possible to add a kind of "waypoints" to this router.