microsoft / msagljs

A JavaScript graph layout engine: port of MSAGL
https://microsoft.github.io/msagljs/
MIT License
146 stars 15 forks source link

No way to alter GeomGraph radX and radY effectively #91

Open wolfmcnally opened 1 month ago

wolfmcnally commented 1 month ago

GeomGraph has public attributes radX and radY which contain the corner radius of the graph's bounding rectangle, used when determining the boundaryCurve for the graph.

This leaves no apparent API for altering the corner radii.

Expected behavior:

My current workaround uses the last method (which breaks encapsulation):

function setCornerRadius(graph: GeomGraph, radius: number) {
    const bounds = graph.boundingBox;
    const rrect = new RRect({left: bounds.left, top: bounds.top, right: bounds.right, bottom: bounds.bottom, radX: radius, radY: radius});
    (graph as any).rrect = rrect;
}
levnach commented 1 month ago

Please create a pull request with a change that you prefer.