Hello, I’m using the latest version of aspose.diagram for Node.js. I’m try to connect the two shapes using arrows, but I get an error. I used the next code:
const connector = new Shape();
const connectorId = page.getShapes().add(connector);
page.connectShapesViaConnector(
shapeFrom.getID(),
ConnectionPointPlace.BOTTOM,
shapeTo.getID(),
ConnectionPointPlace.TOP,
connectorId,
);
In this case I get the following exception - com.aspose.diagram.Diagram.DiagramException: Shape 5 with ID 5 is not a Dynamic connector.
I tried to use drawLine to create a connector, but got strange results (drawLine.png).
const xFrom =
shapeFrom.getXForm().getPinX().getValue() +
shapeFrom.getXForm().getWidth().getValue() / 2;
const yFrom = shapeFrom.getXForm().getPinY().getValue();
const xTo =
shapeTo.getXForm().getPinX().getValue() +
shapeTo.getXForm().getWidth().getValue() / 2;
const yTo =
shapeTo.getXForm().getPinY().getValue() +
shapeTo.getXForm().getHeight().getValue();
const connectorId = page.drawLine(xFrom, yFrom, xTo, yTo);
I also created a connector using the Dynamic connector master from Basic Shapes.vss. In this case, everything works, but the connection points are in unexpected places (dynamic-connector.png).
Can I create a Dynamic connector without using the Stencil of Shapes?
drawLine.jpg (79.0 KB)
dynamic-connector.jpg (76.5 KB)