fix(connection): always scale handle dimensions

This commit is contained in:
moklick
2019-07-30 18:22:33 +02:00
parent 9d17245cca
commit 84a17dd01d
15 changed files with 336 additions and 100 deletions
+10 -2
View File
@@ -1,6 +1,7 @@
import React, { PureComponent } from 'react';
import { Consumer } from '../GraphContext';
import ConnectorEdge from '../ConnectorEdge';
class EdgeRenderer extends PureComponent {
renderEdge(e, nodes, onElementClick) {
@@ -30,7 +31,7 @@ class EdgeRenderer extends PureComponent {
}
render() {
const { width, height } = this.props;
const { width, height, onElementClick } = this.props;
if (!width) {
return null;
@@ -38,7 +39,7 @@ class EdgeRenderer extends PureComponent {
return (
<Consumer>
{({ state, onElementClick }) => (
{({ state }) => (
<svg
width={width}
height={height}
@@ -49,6 +50,13 @@ class EdgeRenderer extends PureComponent {
>
{state.edges.map(e => this.renderEdge(e, state.nodes, onElementClick))}
</g>
{state.isConnecting && (
<ConnectorEdge
nodes={state.nodes}
connectionSourceId={state.connectionSourceId}
connectionPosition={state.connectionPosition}
/>
)}
</svg>
)}
</Consumer>