Skip to content

Commit

Permalink
[2706] Fix children position on re-open
Browse files Browse the repository at this point in the history
Bug: #2706
  • Loading branch information
gcoutable committed Nov 30, 2023
1 parent e2bccdc commit 13e1935
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.adoc
Expand Up @@ -128,8 +128,9 @@ It uses our algorithm instead of elk.js to perform the arrange-all.
- https://github.com/eclipse-sirius/sirius-web/issues/2640[#2640] [diagram] Compute the handle position on diagram conversion, which happens every time a diagram refresh payload is received.
- https://github.com/eclipse-sirius/sirius-web/issues/2647[#2647] [diagram] Split border shorthand CSS properties into non-shorthand properties for list nodes.
Make some border node transparent when the node is in a list node in the convert engine.
- https://github.com/eclipse-sirius/sirius-web/issues/2646[#2646] [diagram] Fix an issue where the palette was re rendering too much.
- https://github.com/eclipse-sirius/sirius-web/issues/2646[#2646] [diagram] Fix an issue where the palette was re-rendering too much.
- https://github.com/eclipse-sirius/sirius-web/issues/2685[#2685] [diagram] Fix direct edit of edge labels with F2.
- https://github.com/eclipse-sirius/sirius-web/issues/[#2706] [diagram] Fix an issue where node children were not correctly positioned.

=== New Features

Expand Down
Expand Up @@ -51,7 +51,8 @@ const toRectangularNode = (
} = gqlNode;

const connectionHandles: ConnectionHandle[] = convertHandles(gqlNode, gqlEdges);
const isNew = gqlDiagram.layoutData.nodeLayoutData.find((nodeLayoutData) => nodeLayoutData.id === id) === undefined;
const nodeLayoutData = gqlDiagram.layoutData.nodeLayoutData.find((data) => data.id === id);
const isNew = nodeLayoutData === undefined;

const data: RectangularNodeData = {
targetObjectId,
Expand Down Expand Up @@ -124,7 +125,6 @@ const toRectangularNode = (
node.parentNode = gqlParentNode.id;
}

const nodeLayoutData = gqlDiagram.layoutData.nodeLayoutData.filter((data) => data.id === id)[0];
if (nodeLayoutData) {
const {
position,
Expand Down
Expand Up @@ -92,7 +92,7 @@ export class RectangleNodeLayoutHandler implements INodeLayoutHandler<Rectangula
// Update children position to be under the label and at the right padding.
directNodesChildren.forEach((child, index) => {
const previousNode = (previousDiagram?.nodes ?? []).find((previouseNode) => previouseNode.id === child.id);
const previousPosition = computePreviousPosition(previousNode, node);
const previousPosition = computePreviousPosition(previousNode, child);
const createdNode = newlyAddedNode?.id === child.id ? newlyAddedNode : undefined;

if (!!createdNode) {
Expand Down

0 comments on commit 13e1935

Please sign in to comment.