refactor(background): allow multiple types #10

This commit is contained in:
moklick
2019-10-08 18:47:18 +02:00
parent f0f10b667c
commit 77faa369d4
6 changed files with 72 additions and 19 deletions
+10 -3
View File
@@ -3,7 +3,7 @@ import { useStoreState, useStoreActions } from 'easy-peasy';
import NodeRenderer from '../NodeRenderer';
import EdgeRenderer from '../EdgeRenderer';
import GridRenderer from '../GridRenderer';
import BackgroundRenderer from '../BackgroundRenderer';
import UserSelection from '../../components/UserSelection';
import NodesSelection from '../../components/NodesSelection';
import useKeyPress from '../../hooks/useKeyPress';
@@ -17,7 +17,8 @@ const GraphView = memo(({
nodeTypes, edgeTypes, onMove, onLoad,
onElementClick, onNodeDragStop, connectionLineType, connectionLineStyle,
selectionKeyCode, onElementsRemove, deleteKeyCode, elements,
onConnect, gridColor, showGrid, gridGap
showBackground, backgroundGap, backgroundColor, backgroundType,
onConnect
}) => {
const zoomPane = useRef();
const rendererNode = useRef();
@@ -68,7 +69,13 @@ const GraphView = memo(({
return (
<div className="react-flow__renderer" ref={rendererNode}>
{showGrid && <GridRenderer gap={gridGap} strokeColor={gridColor} />}
{showBackground && (
<BackgroundRenderer
gap={backgroundGap}
strokeColor={backgroundColor}
backgroundType={backgroundType}
/>
)}
<NodeRenderer
nodeTypes={nodeTypes}
onElementClick={onElementClick}