Add elevateNodesOnSelect prop, fix z-index not increased when selecting nodes

This commit is contained in:
peterkogo
2025-02-19 12:03:55 +01:00
parent e8a971e00a
commit bb28ef4846
3 changed files with 7 additions and 1 deletions
@@ -64,6 +64,7 @@
colorModeSSR, colorModeSSR,
style, style,
defaultEdgeOptions, defaultEdgeOptions,
elevateNodesOnSelect,
...divAttributes ...divAttributes
} = $derived(rest); } = $derived(rest);
@@ -328,6 +328,11 @@ export type SvelteFlowProps = NodeEvents &
* If you have custom connection logic its preferred to use this callback over the isValidConnection prop on the handle component for performance reasons. * If you have custom connection logic its preferred to use this callback over the isValidConnection prop on the handle component for performance reasons.
* @default (connection: Connection) => true * @default (connection: Connection) => true
*/ */
/** Enabling this option will raise the z-index of nodes when they are selected.
* @default true
*/
elevateNodesOnSelect?: boolean;
isValidConnection?: IsValidConnection; isValidConnection?: IsValidConnection;
/** This event handler is called when the user begins to pan or zoom the viewport */ /** This event handler is called when the user begins to pan or zoom the viewport */
onMoveStart?: OnMoveStart; onMoveStart?: OnMoveStart;
@@ -82,7 +82,7 @@ export const getInitialStore = (signals: StoreSignals) => {
adoptUserNodes(signals.nodes, this.nodeLookup, this.parentLookup, { adoptUserNodes(signals.nodes, this.nodeLookup, this.parentLookup, {
nodeExtent: this.nodeExtent, nodeExtent: this.nodeExtent,
nodeOrigin: this.nodeOrigin, nodeOrigin: this.nodeOrigin,
elevateNodesOnSelect: false, elevateNodesOnSelect: signals.props.elevateNodesOnSelect ?? true,
checkEquality: true checkEquality: true
}); });
return signals.nodes; return signals.nodes;