Remove Number() calls
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Siklos 2022-08-15 22:57:08 +02:00
parent dd2079b975
commit 3c164581ce
7 changed files with 34 additions and 34 deletions

View file

@ -15,13 +15,13 @@ interface IContainerProps {
*/
export const Container: React.FC<IContainerProps> = (props: IContainerProps) => {
const containersElements = props.model.children.map(child => <Container key={`container-${child.properties.id}`} model={child} />);
const xText = Number(props.model.properties.width) / 2;
const yText = Number(props.model.properties.height) / 2;
const xText = props.model.properties.width / 2;
const yText = props.model.properties.height / 2;
const [transformedX, transformedY] = transformPosition(
Number(props.model.properties.x),
Number(props.model.properties.y),
Number(props.model.properties.width),
props.model.properties.x,
props.model.properties.y,
props.model.properties.width,
props.model.properties.XPositionReference
);
const transform = `translate(${transformedX}, ${transformedY})`;
@ -48,7 +48,7 @@ export const Container: React.FC<IContainerProps> = (props: IContainerProps) =>
const dimensionMargin = DIMENSION_MARGIN * (depth + 1);
const id = `dim-${props.model.properties.id}`;
const xStart: number = 0;
const xEnd = Number(props.model.properties.width);
const xEnd = props.model.properties.width;
const y = -dimensionMargin;
const strokeWidth = 1;
const text = (props.model.properties.width ?? 0).toString();
@ -112,20 +112,20 @@ function GetChildrenDimensionProps(props: IContainerProps, dimensionMargin: numb
const lastChild = props.model.children[props.model.children.length - 1];
let xChildrenStart = lastChild.properties.x;
let xChildrenEnd = lastChild.properties.x + Number(lastChild.properties.width);
let xChildrenEnd = lastChild.properties.x + lastChild.properties.width;
for (let i = props.model.children.length - 2; i >= 0; i--) {
const child = props.model.children[i];
const left = child.properties.x;
if (left < xChildrenStart) {
xChildrenStart = left;
}
const right = child.properties.x + Number(child.properties.width);
const right = child.properties.x + child.properties.width;
if (right > xChildrenEnd) {
xChildrenEnd = right;
}
}
const yChildren = Number(props.model.properties.height) + dimensionMargin;
const yChildren = props.model.properties.height + dimensionMargin;
const textChildren = (xChildrenEnd - xChildrenStart).toString();
return { childrenId, xChildrenStart, xChildrenEnd, yChildren, textChildren };
}