Undesired content alignment when viewport Bounds is larger than documentBounds

Hi, this is probably a basic question but I’m having a hard time to figure it out.
According to the Diagram API setting the contentAlignment to some spot aligns then diagram “when the viewportBounds width or height is smaller than the documentBounds”.
This doesn’t seem to be the right because the diagram is aligned after every transaction.
To be more specific every time I add a node the diagram, the diagram aligns itself.
What I would like to achieve is an initial content alignment on the diagram and than alignment only when the user is resizing the window.

Each Diagram adds a ‘resize’ listener on window to maybe call Diagram.requestUpdate. (Read more at Page Not Found -- Northwoods Software)

Instead of setting Diagra.contentAlignment, you should add a window ‘resize’ listener that calls Diagram.alignDocument with your desired Spots.

That works great. Thank you.