rename hasActiveSelection to isSelectionEnabled
This commit is contained in:
@@ -77,7 +77,7 @@ export function Pane({
|
||||
}: PaneProps) {
|
||||
const store = useStoreApi();
|
||||
const { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector, shallow);
|
||||
const hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive);
|
||||
const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
|
||||
|
||||
const container = useRef<HTMLDivElement | null>(null);
|
||||
const containerBounds = useRef<DOMRect>();
|
||||
@@ -284,14 +284,14 @@ export function Pane({
|
||||
return (
|
||||
<div
|
||||
className={cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }])}
|
||||
onClick={hasActiveSelection ? undefined : wrapHandler(onClick, container)}
|
||||
onClick={isSelectionEnabled ? undefined : wrapHandler(onClick, container)}
|
||||
onContextMenu={wrapHandler(onContextMenu, container)}
|
||||
onWheel={wrapHandler(onWheel, container)}
|
||||
onPointerEnter={hasActiveSelection ? undefined : onPaneMouseEnter}
|
||||
onPointerMove={hasActiveSelection ? onPointerMove : onPaneMouseMove}
|
||||
onPointerUp={hasActiveSelection ? onPointerUp : undefined}
|
||||
onPointerDownCapture={hasActiveSelection ? onPointerDownCapture : undefined}
|
||||
onClickCapture={hasActiveSelection ? onClickCapture : undefined}
|
||||
onPointerEnter={isSelectionEnabled ? undefined : onPaneMouseEnter}
|
||||
onPointerMove={isSelectionEnabled ? onPointerMove : onPaneMouseMove}
|
||||
onPointerUp={isSelectionEnabled ? onPointerUp : undefined}
|
||||
onPointerDownCapture={isSelectionEnabled ? onPointerDownCapture : undefined}
|
||||
onClickCapture={isSelectionEnabled ? onClickCapture : undefined}
|
||||
onPointerLeave={onPaneMouseLeave}
|
||||
ref={container}
|
||||
style={containerStyle}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
!!store.selectionRect ||
|
||||
(selectionOnDrag && panOnDragActive !== true)
|
||||
);
|
||||
let hasActiveSelection = $derived(
|
||||
let isSelectionEnabled = $derived(
|
||||
store.elementsSelectable && (isSelecting || store.selectionRectMode === 'user')
|
||||
);
|
||||
|
||||
@@ -267,12 +267,12 @@
|
||||
class:draggable={panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0))}
|
||||
class:dragging={store.dragging}
|
||||
class:selection={isSelecting}
|
||||
onclick={hasActiveSelection ? undefined : wrapHandler(onClick, container)}
|
||||
onpointerdowncapture={hasActiveSelection ? onPointerDownCapture : undefined}
|
||||
onpointermove={hasActiveSelection ? onPointerMove : undefined}
|
||||
onpointerup={hasActiveSelection ? onPointerUp : undefined}
|
||||
onclick={isSelectionEnabled ? undefined : wrapHandler(onClick, container)}
|
||||
onpointerdowncapture={isSelectionEnabled ? onPointerDownCapture : undefined}
|
||||
onpointermove={isSelectionEnabled ? onPointerMove : undefined}
|
||||
onpointerup={isSelectionEnabled ? onPointerUp : undefined}
|
||||
oncontextmenu={wrapHandler(onContextMenu, container)}
|
||||
onclickcapture={hasActiveSelection ? onClickCapture : undefined}
|
||||
onclickcapture={isSelectionEnabled ? onClickCapture : undefined}
|
||||
>
|
||||
{@render children()}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user