-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fit to screen on model update is unreliable #121
Comments
Why is an InitializeCanvasBoundsAction triggered? That should happen only if the root element of the model is changed (different type or id). Is that the case in your application? |
When the client is initialized, the model is requested from the server. It seems however that when the client receive a response from the server, the model if first set to the default empty model. Only after that it is set to the actual model received from the server. This is what I get in the browser console (added some extra info):
In this example the FitToScreen actually worked due to the InitializeCanvasBoundsAction before it. If the FitToScreen was received earlier it would not work |
I understand. We might use the |
In case someone is searching on Google how to fit the diagram to screen. Here I paste an extract of my code, where I add a 1s timeout due to this bug
|
Whenever the model is updated I want to execute the
FitToScreenAction
. Currently I do this on the server side by implementingIModelUpdateListener
and dispatching aFitToScreenAction
(like in the flow example). This does seem to work sometimes, but often nothing happens.The issue seems to be caused by a race between the
FitToScreenAction
and theInitializeCanvasBoundsAction
. Because theFitToScreenAction
depends on the canvas bounds, whenever the client receives theFitToScreenAction
before theInitializeCanvasBoundsAction
is executed, the model does not get fit to the screen.The text was updated successfully, but these errors were encountered: