Fix styling of erBox rows

This commit is contained in:
yari-dewalt
2025-02-28 11:05:16 -08:00
parent 4128197468
commit d0986ace8c
2 changed files with 19 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ const getStyles = (options: FlowChartStyleOptions) =>
}
.labelBkg {
background-color: ${fade(options.edgeLabelBackground, 0.5)};
background-color: ${fade(options.tertiaryColor, 0.5)};
}
.edgeLabel .label {

View File

@@ -142,7 +142,6 @@ export async function erBox<T extends SVGGraphicsElement>(parent: D3Selection<T>
TEXT_PADDING;
yOffsets.push(yOffset);
}
yOffsets.pop();
let totalWidthSections = 4;
@@ -228,6 +227,24 @@ export async function erBox<T extends SVGGraphicsElement>(parent: D3Selection<T>
const roughRect = rc.rectangle(x, y, w, h, options);
const rect = shapeSvg.insert(() => roughRect, ':first-child').attr('style', cssStyles!.join(''));
const { themeVariables } = getConfig();
const { secondaryColor, tertiaryColor, nodeBorder } = themeVariables;
yOffsets.push(0);
// Draw row rects
for (const [i, yOffset] of yOffsets.entries()) {
const isEven = i % 2 === 0 && yOffset !== 0;
const roughRect = rc.rectangle(x, nameBBox.height + y + yOffset, w, nameBBox.height, {
...options,
fill: isEven ? tertiaryColor : secondaryColor,
stroke: nodeBorder,
});
shapeSvg
.insert(() => roughRect, 'g.label')
.attr('style', cssStyles!.join(''))
.attr('class', `row-rect-${i % 2 === 0 ? 'even' : 'odd'}`);
}
// Draw divider lines
// Name line
let roughLine = rc.line(x, nameBBox.height + y, w + x, nameBBox.height + y, options);