feat: add option for right click movement.

This commit is contained in:
Jack Fishwick
2022-11-22 10:55:06 +00:00
parent 920136b807
commit b65cc1229d
3 changed files with 22 additions and 4 deletions
@@ -69,7 +69,7 @@ const FlowRenderer = ({
const nodesSelectionActive = useStore(selector);
const selectionKeyPressed = useKeyPress(selectionKeyCode);
const isSelectionMode = selectionKeyPressed || (selectBoxOnDrag && !panOnDrag);
const isSelectionMode = selectionKeyPressed || (selectBoxOnDrag && panOnDrag !== true);
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
@@ -79,7 +79,13 @@ const FlowRenderer = ({
store.setState({ nodesSelectionActive: false });
};
const onContextMenu = onPaneContextMenu ? (event: MouseEvent) => onPaneContextMenu(event) : undefined;
const onContextMenu = (event: MouseEvent) => {
onPaneContextMenu?.(event);
if (panOnDrag === 'RightClick') {
event.preventDefault();
}
};
const onWheel = onPaneScroll ? (event: WheelEvent) => onPaneScroll(event) : undefined;
return (