From badf6ebaf55478f7cb522e774a0f4d3839754ce6 Mon Sep 17 00:00:00 2001 From: Eric NGUYEN Date: Fri, 30 Sep 2022 14:04:10 +0200 Subject: [PATCH] Fix duplicate key in dimension --- src/Components/SVG/Elements/DimensionLayer.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Components/SVG/Elements/DimensionLayer.tsx b/src/Components/SVG/Elements/DimensionLayer.tsx index d4da524..881bea7 100644 --- a/src/Components/SVG/Elements/DimensionLayer.tsx +++ b/src/Components/SVG/Elements/DimensionLayer.tsx @@ -135,7 +135,7 @@ function AddHorizontalChildrenDimension( dimensions: React.ReactNode[], scale: number ): void { - const childrenId = `dim-children-${container.properties.id}`; + const childrenId = `dim-y${yDim.toFixed(0)}-children-${container.properties.id}`; const lastChild = container.children[container.children.length - 1]; let xChildrenStart = TransformX(lastChild.properties.x, lastChild.properties.width, lastChild.properties.positionReference); @@ -183,7 +183,7 @@ function AddVerticalChildrenDimension( dimensions: React.ReactNode[], scale: number ): void { - const childrenId = `dim-v-children-${container.properties.id}`; + const childrenId = `dim-x${xDim.toFixed(0)}-children-${container.properties.id}`; const lastChild = container.children[container.children.length - 1]; let yChildrenStart = TransformY(lastChild.properties.y, lastChild.properties.height, lastChild.properties.positionReference); @@ -262,7 +262,7 @@ function AddHorizontalBorrowerDimension( marks.sort((a, b) => a - b); let count = 0; for (const { cur, next } of Pairwise(marks)) { - const id = `dim-borrow-${container.properties.id}-{${count}}`; + const id = `dim-y${yDim.toFixed(0)}-borrow-${container.properties.id}-{${count}}`; dimensions.push( a - b); let count = 0; for (const { cur, next } of Pairwise(marks)) { - const id = `dim-v-borrow-${container.properties.id}-{${count}}`; + const id = `dim-x${xDim.toFixed(0)}-borrow-${container.properties.id}-{${count}}`; dimensions.push(