Auto Align Nodes to the center

Hey Walter, Is there a way to autoalign the node to the center of the canvas.

I am calling diagram.layoutDiagram(true), which aligns the nodes correctly but sometimes it shifts all the nodes to bottom half of the canvas even when there it can be center aligned

so instead of this

i need something like this

You could call Diagram.centerRect on the Diagram.documentBounds.
Diagram | GoJS API

Perhaps you could call it in a “LayoutCompleted” DiagramEvent listener after calling Diagram.zoomToFit.