How to move a node at center of viewport?

I’m using genogram sample.

this’s my code:

const node = diagram.findNodeForKey(-43);
diagram.centerRect(node.actualBounds);

The node don’t center in the viewport. It should position the entry exactly center of viewport. Please help me for this case.

It might be that it cannot scroll far enough to put that particular node in the center of the viewport.

Please read:
https://gojs.net/latest/intro/initialView.html
https://gojs.net/latest/intro/viewport.html

So I have no way if I don’t change the scale value for this case, right?

A post was split to a new topic: Animating scrolling

Didn’t you read https://gojs.net/latest/intro/viewport.html#DocumentBounds, setting Diagram.padding?
Or https://gojs.net/latest/intro/viewport.html#ScrollingModes, setting Diagram.scrollMode or Diagram.scrollMargin?

I set Diagram.scrollMode is Diagram.InfiniteScroll. It worked. Thanks for your support.