|
11 | 11 | * Obeo - initial API and implementation |
12 | 12 | *******************************************************************************/ |
13 | 13 |
|
14 | | -import { useData } from '@eclipse-sirius/sirius-components-core'; |
| 14 | +import { useData, useSelection } from '@eclipse-sirius/sirius-components-core'; |
15 | 15 | import { |
16 | 16 | Background, |
17 | 17 | BackgroundVariant, |
@@ -100,6 +100,7 @@ export const DiagramRenderer = memo(({ diagramRefreshedEventPayload }: DiagramRe |
100 | 100 | const { onNodeDragStart, onNodeDrag, onNodeDragStop } = useDropNode(); |
101 | 101 | const { backgroundColor, largeGridColor, smallGridColor } = useDropDiagramStyle(); |
102 | 102 | const { nodeTypes } = useNodeType(); |
| 103 | + const { setSelection } = useSelection(); |
103 | 104 |
|
104 | 105 | const { nodeConverters } = useContext<NodeTypeContextValue>(NodeTypeContext); |
105 | 106 |
|
@@ -218,7 +219,10 @@ export const DiagramRenderer = memo(({ diagramRefreshedEventPayload }: DiagramRe |
218 | 219 | } |
219 | 220 | }); |
220 | 221 | } |
221 | | - }, [diagramRefreshedEventPayload, diagramDescription]); |
| 222 | + if (selectionFromTool) { |
| 223 | + setSelection(selectionFromTool); |
| 224 | + } |
| 225 | + }, [diagramRefreshedEventPayload, diagramDescription, setSelection]); |
222 | 226 |
|
223 | 227 | useEffect(() => { |
224 | 228 | if (toolSelections.has(diagramRefreshedEventPayload.id)) { |
@@ -269,6 +273,9 @@ export const DiagramRenderer = memo(({ diagramRefreshedEventPayload }: DiagramRe |
269 | 273 | setEdges(newEdges); |
270 | 274 | setNodes(newNodes); |
271 | 275 | toolSelections.delete(diagramRefreshedEventPayload.id); |
| 276 | + if (selectionFromTool) { |
| 277 | + setSelection(selectionFromTool); |
| 278 | + } |
272 | 279 | } |
273 | 280 | }, [toolSelections]); |
274 | 281 |
|
|
0 commit comments