Closed joeskeen closed 7 months ago
Thanks for the contribution. I believe center
is an optional argument, and if not provided zooming (fit-viewport
) will be done focused on the center.
I wonder if it makes sense to have a dedicated type definition for the fit-viewport
case, as center = false
yields won't center there, but will center for zoom(0.3, false)
.
Interesting. If I understand your last comment, it is expected to center the diagram if the second parameter is not provided? When I tried 'fit-viewport' without a second parameter, my diagram was always ending up at the far left.
If I understand your last comment, it is expected to center the diagram if the second parameter is not provided?
Yes. At best we always center. I don't see a reason why fit-viewbox
should not center the diagram (but push it to the coordinate origin).
As indicated I'd love to have a dedicated override for the 'fit-viewport' case. https://github.com/bpmn-io/diagram-js/pull/859#issuecomment-1945517219.
I was trying to use
canvas.zoom('fit-viewport')
but wanted it centered. Looking at the code, it appears that the second parameter can betrue
in this case to have it automatically center (rather than providing a point). Updating the documentation to reflect this.