From 64c84917615442a5a11741c706d881b1cdb03c65 Mon Sep 17 00:00:00 2001 From: Jack Fishwick Date: Wed, 28 Sep 2022 17:14:13 +0100 Subject: [PATCH] bug fix: more post rebase fixes. --- .../src/components/UserSelection/index.tsx | 12 +++++-- .../core/src/container/FlowRenderer/Pane.tsx | 34 ------------------- .../core/src/container/FlowRenderer/index.tsx | 1 - 3 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 packages/core/src/container/FlowRenderer/Pane.tsx diff --git a/packages/core/src/components/UserSelection/index.tsx b/packages/core/src/components/UserSelection/index.tsx index bfd8adda..b16c7299 100644 --- a/packages/core/src/components/UserSelection/index.tsx +++ b/packages/core/src/components/UserSelection/index.tsx @@ -4,7 +4,9 @@ import { memo, useState, useRef } from 'react'; import shallow from 'zustand/shallow'; +import cc from 'classcat'; +import { containerStyle } from '../../styles'; import { useStore, useStoreApi } from '../../hooks/useStore'; import { getSelectionChanges } from '../../utils/changes'; import { getConnectedEdges, getNodesInside } from '../../utils/graph'; @@ -59,6 +61,7 @@ const wrapHandlers = ( const selector = (s: ReactFlowState) => ({ userSelectionActive: s.userSelectionActive, elementsSelectable: s.elementsSelectable, + paneDragging: s.paneDragging, }); const UserSelection = memo( @@ -81,7 +84,7 @@ const UserSelection = memo( const prevSelectedEdgesCount = useRef(0); const containerBounds = useRef(); const [userSelectionRect, setUserSelectionRect] = useState(null); - const { userSelectionActive, elementsSelectable } = useStore(selector, shallow); + const { userSelectionActive, elementsSelectable, paneDragging } = useStore(selector, shallow); const resetUserSelection = () => { setUserSelectionRect(null); @@ -212,7 +215,12 @@ const UserSelection = memo( ); return ( -
+
{children} {userSelectionActive && userSelectionRect && (
& { - onMouseEnter?: (event: MouseEvent) => void; - onMouseMove?: (event: MouseEvent) => void; - onMouseLeave?: (event: MouseEvent) => void; -}; - -const selector = (s: ReactFlowState) => s.paneDragging; - -function Pane({ onClick, onMouseEnter, onMouseMove, onMouseLeave, onContextMenu, onWheel }: PaneProps) { - const dragging = useStore(selector); - - return ( -
- ); -} - -export default Pane; diff --git a/packages/core/src/container/FlowRenderer/index.tsx b/packages/core/src/container/FlowRenderer/index.tsx index de1f3dd5..84abdb23 100644 --- a/packages/core/src/container/FlowRenderer/index.tsx +++ b/packages/core/src/container/FlowRenderer/index.tsx @@ -8,7 +8,6 @@ import { GraphViewProps } from '../GraphView'; import ZoomPane from '../ZoomPane'; import UserSelection from '../../components/UserSelection'; import NodesSelection from '../../components/NodesSelection'; -import Pane from './Pane'; import type { ReactFlowState } from '../../types'; export type FlowRendererProps = Omit<