Selection process is not interrupted by selectionKey being let go
This commit is contained in:
@@ -28,7 +28,9 @@ export type FlowRendererProps = Omit<
|
|||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const selector = (s: ReactFlowState) => s.nodesSelectionActive;
|
const selector = (s: ReactFlowState) => {
|
||||||
|
return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
|
||||||
|
};
|
||||||
|
|
||||||
const FlowRendererComponent = ({
|
const FlowRendererComponent = ({
|
||||||
children,
|
children,
|
||||||
@@ -67,13 +69,13 @@ const FlowRendererComponent = ({
|
|||||||
onViewportChange,
|
onViewportChange,
|
||||||
isControlledViewport,
|
isControlledViewport,
|
||||||
}: FlowRendererProps) => {
|
}: FlowRendererProps) => {
|
||||||
const nodesSelectionActive = useStore(selector);
|
const { nodesSelectionActive, userSelectionActive } = useStore(selector);
|
||||||
const selectionKeyPressed = useKeyPress(selectionKeyCode);
|
const selectionKeyPressed = useKeyPress(selectionKeyCode);
|
||||||
const panActivationKeyPressed = useKeyPress(panActivationKeyCode);
|
const panActivationKeyPressed = useKeyPress(panActivationKeyCode);
|
||||||
|
|
||||||
const panOnDrag = panActivationKeyPressed || _panOnDrag;
|
const panOnDrag = panActivationKeyPressed || _panOnDrag;
|
||||||
const panOnScroll = panActivationKeyPressed || _panOnScroll;
|
const panOnScroll = panActivationKeyPressed || _panOnScroll;
|
||||||
const isSelecting = selectionKeyPressed || (selectionOnDrag && panOnDrag !== true);
|
const isSelecting = selectionKeyPressed || userSelectionActive || (selectionOnDrag && panOnDrag !== true);
|
||||||
|
|
||||||
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,8 @@
|
|||||||
let selectedNodes: Node[] = [];
|
let selectedNodes: Node[] = [];
|
||||||
|
|
||||||
$: _panOnDrag = $panActivationKeyPressed || panOnDrag;
|
$: _panOnDrag = $panActivationKeyPressed || panOnDrag;
|
||||||
$: isSelecting = $selectionKeyPressed || (selectionOnDrag && _panOnDrag !== true);
|
$: isSelecting =
|
||||||
|
$selectionKeyPressed || $selectionRect || (selectionOnDrag && _panOnDrag !== true);
|
||||||
$: hasActiveSelection = $elementsSelectable && (isSelecting || $selectionRectMode === 'user');
|
$: hasActiveSelection = $elementsSelectable && (isSelecting || $selectionRectMode === 'user');
|
||||||
|
|
||||||
function onClick(event: MouseEvent | TouchEvent) {
|
function onClick(event: MouseEvent | TouchEvent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user