feat(nodesselection): zoom- and scalable nodes selection

This commit is contained in:
moklick
2019-07-24 11:37:40 +02:00
parent 1ba6e7b26b
commit ac8ac49d1d
7 changed files with 161 additions and 58 deletions
+3 -1
View File
@@ -7,10 +7,11 @@ import { GraphContext } from '../GraphContext';
import NodeRenderer from '../NodeRenderer';
import EdgeRenderer from '../EdgeRenderer';
import UserSelection from '../UserSelection';
import NodesSelection from '../NodesSelection';
import { updateTransform, updateSize, initD3, fitView } from '../state/actions';
import { useKeyPress } from '../hooks';
const d3ZoomInstance = d3Zoom.zoom().scaleExtent([0.5, 2])
const d3ZoomInstance = d3Zoom.zoom().scaleExtent([0.5, 2]);
const GraphView = (props) => {
const zoomPane = useRef(null);
@@ -75,6 +76,7 @@ const GraphView = (props) => {
<NodeRenderer nodeTypes={props.nodeTypes} />
<EdgeRenderer width={graphContext.state.width} height={graphContext.state.height} />
{shiftPressed && <UserSelection />}
{graphContext.state.nodesSelectionActive && <NodesSelection />}
<div
className="react-graph__zoompane"
ref={zoomPane}