Fix 0 dimension showing in children dimension

This commit is contained in:
Eric NGUYEN 2022-09-30 11:32:49 +02:00
parent b88539e34d
commit b463c3050c

View file

@ -96,7 +96,7 @@ function Dimensions({ root, scale }: IDimensionLayerProps): React.ReactNode[] {
);
}
if (SHOW_CHILDREN_DIMENSIONS && container.properties.showChildrenDimensions.length > 0 && container.children.length > 1) {
if (SHOW_CHILDREN_DIMENSIONS && container.properties.showChildrenDimensions.length > 0) {
ActionByPosition(
dimMapped,
container.properties.showChildrenDimensions,
@ -154,6 +154,11 @@ function AddHorizontalChildrenDimension(
}
}
if (xChildrenStart === xChildrenEnd) {
// do not show an empty dimension
return;
}
const textChildren = (xChildrenEnd - xChildrenStart)
.toFixed(2)
.toString();
@ -197,6 +202,11 @@ function AddVerticalChildrenDimension(
}
}
if (yChildrenStart === yChildrenEnd) {
// do not show an empty dimension
return;
}
const textChildren = (yChildrenEnd - yChildrenStart)
.toFixed(2)
.toString();