Skip to content

Commit

Permalink
Fix lost characters when typing fast
Browse files Browse the repository at this point in the history
Fixes #99
  • Loading branch information
Magnus Jacobsson authored and Magnus Jacobsson committed May 31, 2019
1 parent d4d3ad2 commit b67a9eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Graph extends React.Component {

handleRenderStaged() {
if (this.renderGraphReady) {
this.selectComponents(this.selectedComponents);
this.markSelectedComponents(this.selectedComponents);
}
}

Expand Down Expand Up @@ -541,6 +541,12 @@ class Graph extends React.Component {
this.unSelectComponents();
this.selectedComponents = components;
}
this.markSelectedComponents(components, extendSelection);
const selectedComponents = this.selectNames.map((name) => this.dotGraph.components[name]);
this.props.onSelect(selectedComponents);
}

markSelectedComponents(components, extendSelection=false) {
let scale = this.graph0.node().getCTM().a * 3 / 4;
let dashLength = Math.max(4 / scale, 2);
let dashWidth = Math.max(4 / scale, 2);
Expand Down Expand Up @@ -576,8 +582,6 @@ class Graph extends React.Component {
this.selectRects = d3_selectAll(rectNodes);
this.selectNames = titles;
}
const selectedComponents = this.selectNames.map((name) => this.dotGraph.components[name]);
this.props.onSelect(selectedComponents);
}

unSelectComponents() {
Expand Down

0 comments on commit b67a9eb

Please sign in to comment.