Diagram not scrolling horizontally to fully cover the diagram

I’m using a virtualized tree layout with the nodes having to expand based on their content. The node’s desiredSize is set to 220 x 50. Sometimes on expanding the nodes the diagram’s horizontal scroll is insufficient to cover the entire diagram and some nodes appear to be cutoff even though the diagram is scrolled all the way to the right.

I would appreciate if anyone could offer some suggestions to fix this issue.


That is probably because the diagram’s (virtual) document bounds is too narrow.

Because the layout needs to work with virtual nodes rather than real Nodes, you’ll note that there is a computeDocumentBounds method that is called at the end of the layout in order to set the Diagram.fixedBounds. Note how that method depends on the Rect that is saved on the data, not on the node’s GraphObject.actualBounds.

But if the size (height or width) is not an accurate estimate of the actual bounds, the diagram’s document bounds will be wrong.

So: did you update the statement:

    //!!!???@@@ this needs to be customized to account for your chosen Node template
    d.bounds = new go.Rect(0, 0, 70, 20);

to match the GraphObject.actualBounds that your Nodes really have?

Thanks Walter! I updated the bounds with the actualBounds and it seems to work fine now.