fix(bgTypes): add bg types to bg renderer #19

This commit is contained in:
moklick
2019-10-09 17:23:02 +02:00
parent 6726a3bbaa
commit 477cc09927
4 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ class App extends PureComponent {
}} }}
connectionLineStyle={{ stroke: '#ddd', strokeWidth: 2 }} connectionLineStyle={{ stroke: '#ddd', strokeWidth: 2 }}
connectionLineType="bezier" connectionLineType="bezier"
backgroundColor="#aaa" backgroundColor="#888"
backgroundGap={16} backgroundGap={16}
> >
<MiniMap <MiniMap
+1 -1
View File
@@ -58,7 +58,7 @@ class App extends PureComponent {
onConnect={params => this.onConnect(params)} onConnect={params => this.onConnect(params)}
onNodeDragStop={onNodeDragStop} onNodeDragStop={onNodeDragStop}
style={{ width: '100%', height: '100%' }} style={{ width: '100%', height: '100%' }}
showBackground={false} backgroundType="lines"
/> />
); );
} }
+4 -3
View File
@@ -4,7 +4,8 @@ import PropTypes from 'prop-types';
import Grid from './Grid'; import Grid from './Grid';
const bgComponents = { const bgComponents = {
grid: Grid lines: Grid,
dots: Grid
}; };
const BackgroundRenderer = memo(({ const BackgroundRenderer = memo(({
@@ -17,11 +18,11 @@ const BackgroundRenderer = memo(({
BackgroundRenderer.displayName = 'BackgroundRenderer'; BackgroundRenderer.displayName = 'BackgroundRenderer';
BackgroundRenderer.propTypes = { BackgroundRenderer.propTypes = {
backgroundType: PropTypes.oneOf(['grid']) backgroundType: PropTypes.oneOf(['lines', 'dots'])
}; };
BackgroundRenderer.defaultProps = { BackgroundRenderer.defaultProps = {
backgroundType: 'grid' backgroundType: 'dots'
}; };
export default BackgroundRenderer; export default BackgroundRenderer;
+2 -2
View File
@@ -76,7 +76,7 @@ ReactFlow.propTypes = {
gridColor: PropTypes.string, gridColor: PropTypes.string,
gridGap: PropTypes.number, gridGap: PropTypes.number,
showBackground: PropTypes.bool, showBackground: PropTypes.bool,
backgroundType: PropTypes.oneOf(['grid']) backgroundType: PropTypes.oneOf(['lines', 'dots'])
}; };
ReactFlow.defaultProps = { ReactFlow.defaultProps = {
@@ -103,7 +103,7 @@ ReactFlow.defaultProps = {
backgroundColor: '#999', backgroundColor: '#999',
backgroundGap: 24, backgroundGap: 24,
showBackground: true, showBackground: true,
backgroundType: 'grid' backgroundType: 'dots'
}; };
export default ReactFlow; export default ReactFlow;