Fix duplicate key in dimension

This commit is contained in:
Eric NGUYEN 2022-09-30 14:04:10 +02:00
parent 6436699ba6
commit badf6ebaf5

View file

@ -135,7 +135,7 @@ function AddHorizontalChildrenDimension(
dimensions: React.ReactNode[], dimensions: React.ReactNode[],
scale: number scale: number
): void { ): 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]; const lastChild = container.children[container.children.length - 1];
let xChildrenStart = TransformX(lastChild.properties.x, lastChild.properties.width, lastChild.properties.positionReference); let xChildrenStart = TransformX(lastChild.properties.x, lastChild.properties.width, lastChild.properties.positionReference);
@ -183,7 +183,7 @@ function AddVerticalChildrenDimension(
dimensions: React.ReactNode[], dimensions: React.ReactNode[],
scale: number scale: number
): void { ): 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]; const lastChild = container.children[container.children.length - 1];
let yChildrenStart = TransformY(lastChild.properties.y, lastChild.properties.height, lastChild.properties.positionReference); let yChildrenStart = TransformY(lastChild.properties.y, lastChild.properties.height, lastChild.properties.positionReference);
@ -262,7 +262,7 @@ function AddHorizontalBorrowerDimension(
marks.sort((a, b) => a - b); marks.sort((a, b) => a - b);
let count = 0; let count = 0;
for (const { cur, next } of Pairwise(marks)) { 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(<Dimension dimensions.push(<Dimension
key={id} key={id}
id={id} id={id}
@ -314,7 +314,7 @@ function AddVerticalBorrowerDimension(
marks.sort((a, b) => a - b); marks.sort((a, b) => a - b);
let count = 0; let count = 0;
for (const { cur, next } of Pairwise(marks)) { 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(<Dimension dimensions.push(<Dimension
key={id} key={id}
id={id} id={id}
@ -337,7 +337,7 @@ function AddVerticalSelfDimension(
scale: number scale: number
): void { ): void {
const height = container.properties.height; const height = container.properties.height;
const idVert = `dim-v-${container.properties.id}`; const idVert = `dim-x${xDim.toFixed(0)}-${container.properties.id}`;
const yStart = container.properties.y + currentTransform[1]; const yStart = container.properties.y + currentTransform[1];
const yEnd = yStart + height; const yEnd = yStart + height;
const textVert = height const textVert = height
@ -365,7 +365,7 @@ function AddHorizontalSelfDimension(
scale: number scale: number
): void { ): void {
const width = container.properties.width; const width = container.properties.width;
const id = `dim-${container.properties.id}`; const id = `dim-y${yDim.toFixed(0)}-${container.properties.id}`;
const xStart = container.properties.x + currentTransform[0]; const xStart = container.properties.x + currentTransform[0];
const xEnd = xStart + width; const xEnd = xStart + width;
const text = width const text = width