Zoom diagram to node

Hi, there. So the question is how can i zoom diagram to a selected node?
I have click handler which get selected node, but i can’t find how can i zoom. Official doc says use smth like this diagram.centerRect(r: Rectangle); I get node object with thousand of keys. Can someone explain what should i do?

found answer:

  • rect -> node.actualBounds
  • zoom -> diagram.zoomToRect(node.actualBounds, 50);

“Zooming” normally means changing the Diagram.scale, not scrolling/panning which changes the Diagram.position.