feat(elements): multiselect

This commit is contained in:
moklick
2020-10-22 00:03:30 +02:00
parent 13a3fd46b1
commit 65a1b5e07a
7 changed files with 58 additions and 8 deletions
+6 -1
View File
@@ -36,6 +36,7 @@ const FlowRenderer = ({
onMoveStart,
onMoveEnd,
selectionKeyCode,
multiSelectionKeyCode,
zoomOnScroll,
zoomOnDoubleClick,
paneMoveable,
@@ -48,12 +49,15 @@ const FlowRenderer = ({
onSelectionContextMenu,
}: FlowRendererProps) => {
const zoomPane = useRef<HTMLDivElement>(null);
const unsetNodesSelection = useStoreActions((actions) => actions.unsetNodesSelection);
const resetSelectedElements = useStoreActions((actions) => actions.resetSelectedElements);
const nodesSelectionActive = useStoreState((state) => state.nodesSelectionActive);
const selectionKeyPressed = useKeyPress(selectionKeyCode);
useResizeHandler(zoomPane);
useGlobalKeyHandler({ onElementsRemove, deleteKeyCode });
useGlobalKeyHandler({ onElementsRemove, deleteKeyCode, multiSelectionKeyCode });
useD3Zoom({
zoomPane,
@@ -73,6 +77,7 @@ const FlowRenderer = ({
(event: MouseEvent) => {
onPaneClick?.(event);
unsetNodesSelection();
resetSelectedElements();
},
[onPaneClick]
);