Node Shape issue when updating diagram using UpdateModelAction #440
-
I am using GLSP vscode extension(https://github.com/eclipse-glsp/glsp-vscode-integration) + GLSP server. I am building graph using GModel (org.eclipse.glsp.graph.GGraph > org.eclipse.glsp.graph.impl.GNodeImpl > org.eclipse.glsp.graph.impl.GLabelImpl). When name of node is edited in the text file, we are triggering update model action(org.eclipse.glsp.server.features.core.model.UpdateModelAction.UpdateModelAction(GModelRoot, boolean)). We are generating new graph object(GGraph) and updating root element using UpdateModelAction. Name will be updated in the diagram but node shape will not be retained .Ids of node and labels are same for both Graphs. If we perform layout operation on graph (alt + l) above layout issue will be fixed. Steps to reproduce the issue:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @sathya-1994
Steps 2 & 3 are automated, so all you have to do is send a FYI: We provide the |
Beta Was this translation helpful? Give feedback.
Hi @sathya-1994
Short answer: To fix this issue you need to dispatch a
RequestBoundsAction
instead of anUpdateModelAction
.Explanation: The bounds (i.e size & width) of some components (e.g. labels) can not be computed on server-side because their actual size depends on how they are displayed & styled on client side. Therefore and update cycle in GLSP consists of the following flow:
RequestBoundsAction
to the clientComputedBoundsAction
to the serverUpdateModelAction
to the client.Steps 2 & 3 are a…