fix(svelte): handle interactionWidth closes #3558

This commit is contained in:
moklick
2023-10-31 15:31:19 +01:00
parent d2ff09b744
commit 22cb43543d
3 changed files with 9 additions and 2 deletions

View File

@@ -17,6 +17,9 @@
export let interactionWidth: $$Props['interactionWidth'] = 20;
let className: $$Props['class'] = undefined;
export { className as class };
// @todo, why is interactionWidth undefined after first re-render?
let interactionWidthValue = interactionWidth === undefined ? 20 : interactionWidth;
</script>
<path
@@ -29,11 +32,11 @@
{style}
/>
{#if interactionWidth}
{#if interactionWidthValue}
<path
d={path}
stroke-opacity={0}
stroke-width={interactionWidth}
stroke-width={interactionWidthValue}
fill="none"
class="svelte-flow__edge-interaction"
/>

View File

@@ -35,6 +35,8 @@
export let sourcePosition: $$Props['sourcePosition'];
export let targetPosition: $$Props['targetPosition'];
export let ariaLabel: $$Props['ariaLabel'] = undefined;
export let interactionWidth: $$Props['interactionWidth'] = undefined;
// @ todo: support edge updates
let className: string = '';
export { className as class };
@@ -104,6 +106,7 @@
{labelStyle}
{data}
{style}
{interactionWidth}
sourceHandleId={sourceHandle}
targetHandleId={targetHandle}
markerStart={markerStartUrl}

View File

@@ -51,6 +51,7 @@
sourcePosition={edge.sourcePosition}
targetPosition={edge.targetPosition}
ariaLabel={edge.ariaLabel}
interactionWidth={edge.interactionWidth}
class={edge.class}
type={edgeType}
{selectable}