diff --git a/docs/components/node.mdx b/docs/components/node.mdx index 017f52ae..d304b85d 100644 --- a/docs/components/node.mdx +++ b/docs/components/node.mdx @@ -152,8 +152,7 @@ detail.node.set.bgColor('red'); Fires when the node is clicked. - Fires when when a mouse up event occurs on the Node. Does not fire if the Node has been dragged - and then released. + Fires when when a mouse up event occurs on the Node. diff --git a/src/lib/components/Edge/Edge.svelte b/src/lib/components/Edge/Edge.svelte index 2908225f..d9c11528 100644 --- a/src/lib/components/Edge/Edge.svelte +++ b/src/lib/components/Edge/Edge.svelte @@ -36,6 +36,7 @@ export let animate = false; export let label = ''; export let enableHover = false; + export let enableDestroyOnClick = false; export let edgeClick: null | (() => void) = null; // Styling via props/objects will likely be deprecated @@ -305,12 +306,17 @@ style:cursor={edgeClick || hovering ? 'pointer' : 'move'} style:--prop-target-edge-color={edgeClick || hovering ? targetColor || null : 'transparent'} d={path} - on:mousedown={edgeClick} + on:mousedown={() => { + edgeClick(edge); + if (enableDestroyOnClick) { + destroy(); + } + }} on:mouseenter={() => (hovering = true)} on:mouseleave={() => (hovering = false)} bind:this={DOMPath} /> - + ; moving: Writable; + moved: Writable; label: Writable; // Primary label for default node dimensions: Dimensions; inputs: Writable; //Number of default input anchors to render diff --git a/src/lib/utils/creators/createNode.ts b/src/lib/utils/creators/createNode.ts index ec31d2e5..1d12575a 100644 --- a/src/lib/utils/creators/createNode.ts +++ b/src/lib/utils/creators/createNode.ts @@ -53,6 +53,10 @@ export function createNode(userNode: NodeConfig): Node { rotation: writable(rotation || 0), // hideable: writable(true), moving: writable(false), + moved: writable({ + x: 0, + y: 0 + }), resizingWidth: writable(false), resizingHeight: writable(false), rotating: writable(false), diff --git a/src/routes/events/+page.svelte b/src/routes/events/+page.svelte new file mode 100644 index 00000000..ddbbfd1f --- /dev/null +++ b/src/routes/events/+page.svelte @@ -0,0 +1,71 @@ + + + + + + +