Add a max scale option in canvas.fitToScreen
Description
In the case the canvas bounding box is 'small' (a few nodes) the fit to screen option can lead to nodes being magnified quite aggresively. A max scale parameter may be helpful there.
Additional Context
No response
Hi! Thanks for the suggestion — you’re absolutely right that aggressive zooming can be an issue when there are only a few nodes on the canvas.
We already provide a built-in method for this:
fitToScreen(padding: IPoint = { x: 0, y: 0 }, animated: boolean = true): void;
The fitToScreen method automatically adjusts the view so that all nodes fit within the canvas, scaling and centering them. You can provide a custom padding to add horizontal and vertical space around the content — this helps avoid zooming in too much when the layout is small. You can also control whether the transition is animated.
Let me know if you’d like more control (e.g., a maxScale limit) — we may consider that for future updates.
I would love it if fitToScreen would listen to the max and min zoom levels set on the canvas. Or at least have the option to listen to them.