feat(svelte): edge marker support

This commit is contained in:
moklick
2023-05-15 16:15:42 +02:00
parent 24400d259b
commit 425f625020
22 changed files with 236 additions and 60 deletions
@@ -31,14 +31,14 @@
let className: $$Props['class'] = '';
export { className as class };
const { transform, id } = useStore();
const { transform, flowId } = useStore();
const patternColor = color || defaultColor[variant!];
const patternSize = size || defaultSize[variant!];
const isDots = variant === BackgroundVariant.Dots;
const isCross = variant === BackgroundVariant.Cross;
const gapXY: number[] = Array.isArray(gap!) ? gap! : [gap!, gap!];
$: patternId = `background-pattern-${$id}`;
$: patternId = `background-pattern-${$flowId}`;
$: scaledGap = [gapXY[0] * $transform[2] || 1, gapXY[1] * $transform[2] || 1];
$: scaledSize = patternSize * $transform[2];
$: patternDimensions = (isCross ? [scaledSize, scaledSize] : scaledGap) as [number, number];