mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Updated filled circle
This commit is contained in:
parent
d75661e49d
commit
525dcd4760
@ -8,6 +8,7 @@ import {
|
|||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
|
import { getConfig } from '$root/config.js';
|
||||||
|
|
||||||
export const filledCircle = (parent: SVG, node: Node) => {
|
export const filledCircle = (parent: SVG, node: Node) => {
|
||||||
const { labelStyles, nodeStyles } = styles2String(node);
|
const { labelStyles, nodeStyles } = styles2String(node);
|
||||||
@ -22,20 +23,21 @@ export const filledCircle = (parent: SVG, node: Node) => {
|
|||||||
|
|
||||||
// @ts-ignore - rough is not typed
|
// @ts-ignore - rough is not typed
|
||||||
const rc = rough.svg(shapeSvg);
|
const rc = rough.svg(shapeSvg);
|
||||||
const options = userNodeOverrides(node, {});
|
const { themeVariables } = getConfig();
|
||||||
|
const { nodeBorder } = themeVariables;
|
||||||
|
const options = userNodeOverrides(node, { fillStyle: 'solid' });
|
||||||
|
|
||||||
if (node.look !== 'handDrawn') {
|
if (node.look !== 'handDrawn') {
|
||||||
options.roughness = 0;
|
options.roughness = 0;
|
||||||
options.fillStyle = 'solid';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const circleNode = rc.circle(0, 0, radius * 2, options);
|
const circleNode = rc.circle(0, 0, radius * 2, options);
|
||||||
|
|
||||||
const filledCircle = shapeSvg.insert(() => circleNode, ':first-child');
|
const filledCircle = shapeSvg.insert(() => circleNode, ':first-child');
|
||||||
|
|
||||||
// filledCircle.attr('class', 'basic label-container');
|
filledCircle.selectAll('path').attr('style', `fill: ${nodeBorder} !important;`);
|
||||||
|
|
||||||
if (cssStyles && node.look !== 'handDrawn') {
|
if (cssStyles && cssStyles.length > 0 && node.look !== 'handDrawn') {
|
||||||
filledCircle.selectAll('path').attr('style', cssStyles);
|
filledCircle.selectAll('path').attr('style', cssStyles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user