mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Merge pull request #6838 from saurabhg772244/saurabh/fix-node-border-style-for-hand-drawn-shapes
Saurabh/fix-node-border-style-for-hand-drawn-shapes
This commit is contained in:
5
.changeset/six-planets-rescue.md
Normal file
5
.changeset/six-planets-rescue.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'mermaid': patch
|
||||
---
|
||||
|
||||
fix: node border style for handdrawn shapes
|
@@ -104,8 +104,23 @@ export const userNodeOverrides = (node: Node, options: any) => {
|
||||
seed: handDrawnSeed,
|
||||
strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3,
|
||||
fillLineDash: [0, 0],
|
||||
strokeLineDash: getStrokeDashArray(stylesMap.get('stroke-dasharray')),
|
||||
},
|
||||
options
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
||||
const getStrokeDashArray = (strokeDasharrayStyle?: string) => {
|
||||
if (!strokeDasharrayStyle) {
|
||||
return [0, 0];
|
||||
}
|
||||
const dashArray = strokeDasharrayStyle.trim().split(/\s+/).map(Number);
|
||||
if (dashArray.length === 1) {
|
||||
const val = isNaN(dashArray[0]) ? 0 : dashArray[0];
|
||||
return [val, val];
|
||||
}
|
||||
const first = isNaN(dashArray[0]) ? 0 : dashArray[0];
|
||||
const second = isNaN(dashArray[1]) ? 0 : dashArray[1];
|
||||
return [first, second];
|
||||
};
|
||||
|
Reference in New Issue
Block a user