Thanks Martin, I understand this is possible. However, it does not fix the core issue as my overlays are data driven and can be different sizes. I am also trying to maximize the viewport with some large diagrams, so zooming further out in all directions even if overlays might not exist in that location is not ideal.
I now have a working solution to loop through all of the overlays and set the zoom and canvas scroll to ensure they are all fully visible, but it would be great to see a better option.
@Kieran Happy to take a contribution to improve this.
For example, we could take overlays + their sizes into account when computing the canvas bounding box. Another alternative could be to zoom + dynamically position overlays to ensure they are within the viewbox.