Merged PR 308: #8224/#7571 Margins cotation and Colors

Related work items: #8224
This commit is contained in:
Carl Fuchs 2023-01-30 14:59:55 +00:00
parent 4e8f465405
commit a7feebdcd1
18 changed files with 425 additions and 150 deletions

View file

@ -24,7 +24,7 @@ function GetDimensionsNodes(
let lastY = 0;
for (const { container, depth } of it) {
if (currentDepth !== depth) {
AddNewDimension(currentDepth, min, max, lastY, scale, dimensions);
AddNewDimension(currentDepth, min, max, lastY, scale, '#000000', dimensions);
currentDepth = depth;
min = Infinity;
@ -43,7 +43,7 @@ function GetDimensionsNodes(
}
}
AddNewDimension(currentDepth, min, max, lastY, scale, dimensions);
AddNewDimension(currentDepth, min, max, lastY, scale, '#000000', dimensions);
return dimensions;
}
@ -70,12 +70,11 @@ export function DepthDimensionLayer(props: IDimensionLayerProps): JSX.Element {
);
}
function AddNewDimension(currentDepth: number, min: number, max: number, lastY: number, scale: number, dimensions: React.ReactNode[]): void {
function AddNewDimension(currentDepth: number, min: number, max: number, lastY: number, scale: number, color: string, dimensions: React.ReactNode[]): void {
const id = `dim-depth-${currentDepth}`;
const xStart = min;
const xEnd = max;
const y = lastY + (DIMENSION_MARGIN * (currentDepth + 1)) / scale;
const strokeWidth = 1;
const width = xEnd - xStart;
const text = width
.toFixed(0)
@ -93,9 +92,9 @@ function AddNewDimension(currentDepth: number, min: number, max: number, lastY:
yStart={y}
xEnd={xEnd}
yEnd={y}
strokeWidth={strokeWidth}
text={text}
scale={scale}
color={color}
/>
);
}