how to limit the scroll of the diagram?

I need to limit the scroll of the diagram to prevent it from leaving the canvas as seen in the image.

Captura

I checked the MoveCanvas module of diagram-js but I’m not finding the solution. Any ideas?

MoveCanvas is not the right place. Have a look at Canvas#scroll and probably also Canvas#viewbox.

hello,Lucas_Krmpotic!I meet the same problem,are you solve it?