Disable diagram movement on scrollToPart

I am trying to select a node at random from my tree table, but when the ScrollToPart on the selected Node I am seeing two issues -


  1. The diagram moves/jumps position
    I set "animationManager.isEnabled": false, but the position still changes
  2. When I select a node - I want the selection adornment to be over the entire row,

Here’s my code

function selectAtRandom() {
            const nda = myDiagram.model.nodeDataArray;
            const data = nda[Math.floor(Math.random() * (nda.length - 1)) + 1];
            if (data) {
                const node = myDiagram.findNodeForData(data);
                //Doesn't animate and move node to center but also doesn't expand necessary node



Yes, CommandHandler.scrollToPart CommandHandler | GoJS API is documented to call Diagram.centerRect, which means it tries to scroll so that Part is centered in the viewport.

I suppose you want to call Diagram.scrollToRect instead. Be sure that the argument to methods whose names end with “Rect” is actually a Rect, not a Node or any kind of GraphObject. You can call GraphObject.getDocumentBounds to get a Rect in document coordinates. For Parts such as Nodes, the result will be the same as its actualBounds.