|
38 | 38 | import org.eclipse.sirius.components.diagrams.components.DiagramComponentProps; |
39 | 39 | import org.eclipse.sirius.components.diagrams.components.DiagramComponentProps.Builder; |
40 | 40 | import org.eclipse.sirius.components.diagrams.description.DiagramDescription; |
| 41 | +import org.eclipse.sirius.components.diagrams.description.DiagramLayoutOption; |
41 | 42 | import org.eclipse.sirius.components.diagrams.events.IDiagramEvent; |
42 | 43 | import org.eclipse.sirius.components.diagrams.events.undoredo.DiagramEdgeLayoutEvent; |
43 | 44 | import org.eclipse.sirius.components.diagrams.events.undoredo.DiagramLabelLayoutEvent; |
@@ -186,7 +187,8 @@ private Diagram doRender(Object targetObject, IEditingContext editingContext, Di |
186 | 187 | .filter(DiagramEdgeLayoutEvent.class::isInstance) |
187 | 188 | .map(DiagramEdgeLayoutEvent.class::cast).toList(); |
188 | 189 |
|
189 | | - var newLayoutData = optionalPreviousDiagram.map(Diagram::getLayoutData).orElse(new DiagramLayoutData(Map.of(), Map.of(), Map.of())); |
| 190 | + var newLayoutData = optionalPreviousDiagram.map(Diagram::getLayoutData).orElse(new DiagramLayoutData(Map.of(), Map.of(), Map.of(), |
| 191 | + !diagramDescription.getLayoutOption().equals(DiagramLayoutOption.NONE))); |
190 | 192 |
|
191 | 193 | diagramNodeLayoutEvents.forEach(nodeLayoutDataEvent -> |
192 | 194 | newLayoutData.nodeLayoutData().put(nodeLayoutDataEvent.nodeId(), nodeLayoutDataEvent.nodeLayoutData())); |
@@ -230,7 +232,14 @@ public Diagram updateLayout(IEditingContext editingContext, Diagram diagram, Lay |
230 | 232 | (oldValue, newValue) -> newValue |
231 | 233 | )); |
232 | 234 |
|
233 | | - var layoutData = new DiagramLayoutData(nodeLayoutData, edgeLayoutData, labelLayoutData); |
| 235 | + boolean autoLaidOut = diagram.getLayoutData().autoLaidOut(); |
| 236 | + if (layoutDiagramInput.diagramLayoutData().cancelAutoLayout()) { |
| 237 | + autoLaidOut = false; |
| 238 | + } |
| 239 | + if (layoutDiagramInput.diagramLayoutData().startAutoLayout()) { |
| 240 | + autoLaidOut = true; |
| 241 | + } |
| 242 | + var layoutData = new DiagramLayoutData(nodeLayoutData, edgeLayoutData, labelLayoutData, autoLaidOut); |
234 | 243 | var laidOutDiagram = Diagram.newDiagram(diagram) |
235 | 244 | .layoutData(layoutData) |
236 | 245 | .build(); |
|
0 commit comments