diff --git a/src/Components/SVG/Elements/Container.tsx b/src/Components/SVG/Elements/Container.tsx index cb722d6..050d892 100644 --- a/src/Components/SVG/Elements/Container.tsx +++ b/src/Components/SVG/Elements/Container.tsx @@ -59,7 +59,7 @@ export function Container(props: IContainerProps): JSX.Element { const xEnd = width; const yDim = -dimensionMargin; const strokeWidth = 1; - const text = (width ?? 0).toString(); + const text = (width.toFixed(2) ?? 0).toString(); let childrenDimensions: JSX.Element | null = null; if (props.model.properties.showChildrenDimensions && props.model.children.length > 1 && SHOW_CHILDREN_DIMENSIONS) { @@ -109,7 +109,7 @@ export function Container(props: IContainerProps): JSX.Element { yStart={props.model.properties.height + yDim * -1} yEnd={props.model.properties.height + yDim * -1} strokeWidth={strokeWidth} - text={(next - cur).toString()} />); + text={(next - cur).toFixed(2).toString()} />); count++; } } @@ -167,7 +167,9 @@ function GetChildrenDimensionProps(props: IContainerProps, dimensionMargin: numb } const yChildren = props.model.properties.height + dimensionMargin; - const textChildren = (xChildrenEnd - xChildrenStart).toString(); + const textChildren = (xChildrenEnd - xChildrenStart) + .toFixed(2) + .toString(); return { childrenId, xChildrenStart, xChildrenEnd, yChildren, textChildren }; } diff --git a/src/Components/SVG/Elements/DepthDimensionLayer.tsx b/src/Components/SVG/Elements/DepthDimensionLayer.tsx index 652c04a..685aa7b 100644 --- a/src/Components/SVG/Elements/DepthDimensionLayer.tsx +++ b/src/Components/SVG/Elements/DepthDimensionLayer.tsx @@ -70,7 +70,9 @@ function AddNewDimension(currentDepth: number, min: number, max: number, lastY: const y = lastY + (DIMENSION_MARGIN * (currentDepth + 1)); const strokeWidth = 1; const width = xEnd - xStart; - const text = width.toString(); + const text = width + .toFixed(2) + .toString(); if (width === 0) { return; diff --git a/src/Components/SVG/Elements/DimensionLayer.tsx b/src/Components/SVG/Elements/DimensionLayer.tsx index d6f2b82..588b782 100644 --- a/src/Components/SVG/Elements/DimensionLayer.tsx +++ b/src/Components/SVG/Elements/DimensionLayer.tsx @@ -18,7 +18,9 @@ function GetDimensionsNodes(root: ContainerModel): React.ReactNode[] { const xEnd = xStart + width; const y = (container.properties.y + container.properties.height) + (DIMENSION_MARGIN * (depth + 1)); const strokeWidth = 1; - const text = width.toString(); + const text = width + .toFixed(2) + .toString(); dimensions.push(