Maybe you have a situation where the middle of the viewport is at a document point that cannot be centered because the diagram cannot be scrolled far enough? You can either increase the Diagram.padding (which increases the document bounds) or the Diagram.scrollMargin (which increases how far one can scroll) or you can turn off scrolling limitations entirely by setting Diagram.scrollMode to go.Diagram.InfiniteScroll.
I have turned on the infinite scroll but now once i’m out scrolling the diagram out of the visible space the placed object by model.commit is also out of the canvas’ visible space but technically it is the center of the entire canvas. What i want is to place the node at center of the screen.
I don’t understand what the problem is. Here’s my test code. Note that I do not assign Diagram.padding or Diagram.scrollMargin or Diagram.scrollMode. Even after zooming in or out and panning, each time I click on the HTML button the new node is placed at the center of the viewport.