Closed JanKoehnlein closed 7 years ago
Pushed a fix to master, that definitely needs more polishing.
Main idea is to copy the layout information from the last model to the new one on the server, and using a flag revalidateBounds
to signal to the client to update the bounds using the DOM information and only cause a new SetBoundsAction
if the bounds differ.
This is the current event flow
5 and 6 are unnecessary and cause some strange, invalid intermediate state on the client
It seems we need more state in the protocol or a different one, e.g.
Open questions:
The event flow is now optimized for different scenarios. The model source is responsible to trigger the events in correct order. We'll document this in the Wiki soon.
This is how an update currently works
UpdateModel
RequestModel
SetModel
with a clean new model that does not have layout informationViewer
renders the model without layout information. Everything is now located at (0,0). This causes some serious flickering. We have to render as this is the only way to get the real bounds. Switching opacity to 0 would not prevent the flickering, as that would make the entire existing model transparent.BoundsUpdater
grabs bounds from SVG and issues aSetModelBounds
UpdateModel
RequestModel
SetModel
. Now the model contains the correct layout information.Viewer
renders the correct model.Apart from the in my opinion unnecessary
UpdateModel
/RequestModel
handshake whcih makes the entire thing pretty slow (it is an update only!), we forget existing layout information resulting in a notable flickering.The server should not let go the bounds information but attach the one from the previous layout to the new model. This will avoid the flickering of the unchanged parts of the diagram. We could nevertheless mark all bounds as invalid (other than setting it to empty) such that the BoundsUpdater can recalculate them and issue a
SetBounds
if they have changed (e.g. when a node has to be resized because its content has changed).In addition, we should also introducing a separate command / action pair for diagram updates, e.g.
Reconcile
, replacingSetModel
and giving us the chance to calculate a nice transition. If we stick toRequestModel
, it should contain a flag indicating whether the result should be aSetModel
or aReconcile
.