bpmn-visualization-js
bpmn-visualization-js copied to clipboard
[INFRA] Avoid extra zoom reset when fitting
We have introduced this extra reset when implementing #867.
As for #840, this implies extra computation (and probably rendering). We should probably add performance tests as for 'fit' (at runtime, in addition to already available tests for 'fit on load'), see #839
Initial performance check shows the extra reset seems to not have impact at diagram load time.
But it increases the fit processing time when fit is changed at runtime: for instance, up to 250 ms when rendering B.2.0 (depending what was the previous zoom level and the targeted fit type).
The reset is done by calling mxgraph.zoomActual prior applying any fit operation.
Without the extra reset,
- Fit center is not applied correctly when the previous fit was not 'None'. This may be an issue involving the internal current zoom factor
- applying the same fit several time in a raw change the rendering, whereas we expect it to stay the same. We see the same behaviour with draw.io and with previous poc (#361 and #555), so this seems not related to our custom implementation involving the need of storing the zoomFactor.
zoomActual only on None
Fit Center is not applied correctly

Apply the same fit several times

zoomActual everytime (as implemented in #867)

