Center diagram on demand

Hello,

A simple one: I would like to do the same thing as initialContentAlignment = Spot.Center, but on-demand e.g. when I click a button in my UI.

I tried to set the contentAlignment to Center, then reset it to Default, but that did not work.

Thanks!
Marc.

Yes, Diagram.contentAlignment is used continuously, and Diagram.initialContentAlignment naturally only applies when there’s a new model.
Call Diagram.alignDocument(go.Spot.Center, go.Spot.Center).