Fix border style for hand drawn shapes

This commit is contained in:
saurabhg772244
2025-08-08 14:17:09 +05:30
parent 074701e316
commit 5af489d8dd

View File

@@ -104,8 +104,23 @@ export const userNodeOverrides = (node: Node, options: any) => {
seed: handDrawnSeed, seed: handDrawnSeed,
strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3, strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3,
fillLineDash: [0, 0], fillLineDash: [0, 0],
strokeLineDash: getStrokeDashArray(stylesMap.get('stroke-dasharray')),
}, },
options options
); );
return result; 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];
};