refactor(edges): only redraw moved edges

This commit is contained in:
moklick
2019-07-31 16:29:04 +02:00
parent ec7231e42d
commit 6e71591cb8
9 changed files with 433 additions and 400 deletions
+2 -3
View File
@@ -32,13 +32,12 @@ function renderNode(d, props, graphContext) {
const NodeRenderer = memo((props) => {
const graphContext = useContext(GraphContext);
const { transform, nodes } = graphContext.state;
const transformStyle = { transform : `translate(${transform[0]}px,${transform[1]}px) scale(${transform[2]})` };
return (
<div
className="react-graph__nodes"
style={{
transform: `translate(${transform[0]}px,${transform[1]}px) scale(${transform[2]})`
}}
style={transformStyle}
>
{nodes.map(d => renderNode(d, props, graphContext))}
</div>