add onselectionstart onselectionend

This commit is contained in:
peterkogo
2025-05-13 17:44:28 +02:00
parent 17646123de
commit ec9d4f3145
4 changed files with 21 additions and 3 deletions
@@ -50,6 +50,8 @@
selectionOnDrag, selectionOnDrag,
onpaneclick, onpaneclick,
onpanecontextmenu, onpanecontextmenu,
onselectionstart,
onselectionend,
children children
}: PaneProps<NodeType, EdgeType> = $props(); }: PaneProps<NodeType, EdgeType> = $props();
@@ -115,7 +117,7 @@
y y
}; };
// onSelectionStart?.(event); onselectionstart?.(event);
} }
function onPointerMove(event: PointerEvent) { function onPointerMove(event: PointerEvent) {
@@ -201,7 +203,7 @@
selectionInProgress = false; selectionInProgress = false;
} }
// onSelectionEnd?.(event); onselectionend?.(event);
} }
const onContextMenu = (event: MouseEvent) => { const onContextMenu = (event: MouseEvent) => {
@@ -6,5 +6,7 @@ export type PaneProps<NodeType extends Node = Node, EdgeType extends Edge = Edge
store: SvelteFlowStore<NodeType, EdgeType>; store: SvelteFlowStore<NodeType, EdgeType>;
panOnDrag?: boolean | number[]; panOnDrag?: boolean | number[];
selectionOnDrag?: boolean; selectionOnDrag?: boolean;
onselectionstart?: (event: PointerEvent) => void;
onselectionend?: (event: PointerEvent) => void;
children: Snippet; children: Snippet;
} & PaneEvents; } & PaneEvents;
@@ -45,6 +45,8 @@
onnodepointerleave, onnodepointerleave,
onselectionclick, onselectionclick,
onselectioncontextmenu, onselectioncontextmenu,
onselectionstart,
onselectionend,
onedgeclick, onedgeclick,
onedgecontextmenu, onedgecontextmenu,
onedgepointerenter, onedgepointerenter,
@@ -157,7 +159,15 @@
{onmoveend} {onmoveend}
{oninit} {oninit}
> >
<Pane bind:store {onpaneclick} {onpanecontextmenu} {panOnDrag} {selectionOnDrag}> <Pane
bind:store
{onpaneclick}
{onpanecontextmenu}
{onselectionstart}
{onselectionend}
{panOnDrag}
{selectionOnDrag}
>
<ViewportComponent bind:store> <ViewportComponent bind:store>
<div class="svelte-flow__viewport-back svelte-flow__container"></div> <div class="svelte-flow__viewport-back svelte-flow__container"></div>
<EdgeRenderer <EdgeRenderer
@@ -467,4 +467,8 @@ export type SvelteFlowProps<
onselectiondrag?: OnSelectionDrag<NodeType>; onselectiondrag?: OnSelectionDrag<NodeType>;
/** This event handler gets called when a user stops dragging a selection box. */ /** This event handler gets called when a user stops dragging a selection box. */
onselectiondragstop?: OnSelectionDrag<NodeType>; onselectiondragstop?: OnSelectionDrag<NodeType>;
/** This event handler gets called when the user starts to drag a selection box */
onselectionstart?: (event: PointerEvent) => void;
/** This event handler gets called when the user finishes dragging a selection box */
onselectionend?: (event: PointerEvent) => void;
}; };