From c44413d816604ae2d6ad81ed227c3dfde1a7bd8a Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 10 Oct 2022 11:40:25 +0200 Subject: [PATCH] chore(panel): dont break user selection above panel --- packages/core/src/components/Panel/index.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/core/src/components/Panel/index.tsx b/packages/core/src/components/Panel/index.tsx index 2f68f134..756caca6 100644 --- a/packages/core/src/components/Panel/index.tsx +++ b/packages/core/src/components/Panel/index.tsx @@ -1,18 +1,26 @@ import { HTMLAttributes, ReactNode } from 'react'; import cc from 'classcat'; -import { PanelPosition } from '../../types'; +import { PanelPosition, ReactFlowState } from '../../types'; +import { useStore } from '../../hooks/useStore'; export type PanelProps = HTMLAttributes & { position: PanelPosition; children: ReactNode; }; -function Panel({ position, children, className, ...rest }: PanelProps) { +const selector = (s: ReactFlowState) => (s.userSelectionActive ? 'none' : 'all'); + +function Panel({ position, children, className, style, ...rest }: PanelProps) { + const pointerEvents = useStore(selector); const positionClasses = `${position}`.split('-'); return ( -
+
{children}
);