From d34ecbf802bbcc6a507033c4752c25de560b78cb Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 12 Dec 2022 16:19:06 +0100 Subject: [PATCH] refactor(selectionMode): rename options --- examples/vite-app/src/examples/Figma/index.tsx | 2 +- packages/core/src/components/UserSelection/index.tsx | 4 ++-- packages/core/src/container/ReactFlow/index.tsx | 2 +- packages/core/src/types/general.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/vite-app/src/examples/Figma/index.tsx b/examples/vite-app/src/examples/Figma/index.tsx index bddc4e0b..d6063dde 100644 --- a/examples/vite-app/src/examples/Figma/index.tsx +++ b/examples/vite-app/src/examples/Figma/index.tsx @@ -64,7 +64,7 @@ const BasicFlow = () => { defaultNodes={initialNodes} defaultEdges={initialEdges} selectionOnDrag - selectionMode={SelectionMode.Overlap} + selectionMode={SelectionMode.Partial} panOnDrag={spaceBarPressed ? true : 'RightClick'} panOnScroll onPaneContextMenu={logEvent} diff --git a/packages/core/src/components/UserSelection/index.tsx b/packages/core/src/components/UserSelection/index.tsx index 25ed3296..f5dc551d 100644 --- a/packages/core/src/components/UserSelection/index.tsx +++ b/packages/core/src/components/UserSelection/index.tsx @@ -57,7 +57,7 @@ const selector = (s: ReactFlowState) => ({ const UserSelection = memo( ({ isSelecting, - selectionMode = SelectionMode.Contained, + selectionMode = SelectionMode.Full, panOnDrag, onSelectionStart, onSelectionEnd, @@ -151,7 +151,7 @@ const UserSelection = memo( nodeInternals, nextUserSelectRect, transform, - selectionMode === SelectionMode.Overlap, + selectionMode === SelectionMode.Partial, true, nodeOrigin ); diff --git a/packages/core/src/container/ReactFlow/index.tsx b/packages/core/src/container/ReactFlow/index.tsx index 14cd4d39..183df8c0 100644 --- a/packages/core/src/container/ReactFlow/index.tsx +++ b/packages/core/src/container/ReactFlow/index.tsx @@ -102,7 +102,7 @@ const ReactFlow = forwardRef( deleteKeyCode = 'Backspace', selectionKeyCode = 'Shift', selectionOnDrag = false, - selectionMode = SelectionMode.Contained, + selectionMode = SelectionMode.Full, multiSelectionKeyCode = 'Meta', zoomActivationKeyCode = 'Meta', snapToGrid = false, diff --git a/packages/core/src/types/general.ts b/packages/core/src/types/general.ts index b083964f..6bcd06fc 100644 --- a/packages/core/src/types/general.ts +++ b/packages/core/src/types/general.ts @@ -252,8 +252,8 @@ export type ProOptions = { export type UseDragEvent = D3DragEvent; export enum SelectionMode { - Overlap = 'overlap', - Contained = 'contained', + Partial = 'partial', + Full = 'full', } export type SelectionRect = Rect & {