Skip to content

Commit

Permalink
hotfix: Make sure to assing zoom callback at first render #354 @Tranq…
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcaldas committed Aug 8, 2020
1 parent 5e5d76e commit 01c0843
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sandbox/Sandbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export default class Sandbox extends React.Component {
</button>
<span className="container__graph-info">
<b>Nodes: </b> {this.state.data.nodes.length} | <b>Links: </b> {this.state.data.links.length} |{" "}
<b>Current zoom: </b> {this.state.currentZoom ? this.state.currentZoom.toFixed(3) : ""}
<b>Zoom: </b> {this.state.currentZoom ? this.state.currentZoom.toFixed(3) : "-"}
</span>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/graph/Graph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ export default class Graph extends React.Component {
this.nodeClickTimer = null;
this.isDraggingNode = false;
this.state = initializeGraphState(this.props, this.state);
this.debouncedOnZoomChange = this.props.onZoomChange ? debounce(this.props.onZoomChange, 100) : null;
}

/**
Expand Down

1 comment on commit 01c0843

@TranquilMarmot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!!! Thanks!

Please sign in to comment.