Skip to content

Commit 204369a

Browse files
authored
Fix/default node symbol (#11)
* Fix default node symbol (:circle: it is) * Call onPauseSimulation instead * Call _tick instead. :bug: in configUpdated flag
1 parent bab2c93 commit 204369a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/components/Graph/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class Graph extends React.Component {
102102
/**
103103
* Handles d3 drag 'start' event.
104104
*/
105-
_onDragStart = () => !this.state.config.staticGraph && this.state.simulation.stop();
105+
_onDragStart = () => this.pauseSimulation();
106106

107107
/**
108108
* Sets nodes and links highlighted value.
@@ -120,7 +120,7 @@ export default class Graph extends React.Component {
120120
});
121121
}
122122

123-
this.setState(this.state || {});
123+
this._tick();
124124
}
125125

126126
/**
@@ -191,7 +191,7 @@ export default class Graph extends React.Component {
191191
// @TODO: hardcoded alpha target
192192
this.state.simulation.alphaTarget(0.08).restart();
193193

194-
this.setState(this.state || {});
194+
this._tick();
195195
}
196196
}
197197

@@ -304,7 +304,7 @@ export default class Graph extends React.Component {
304304
Utils.throwErr(this.constructor.name, ERRORS.STATIC_GRAPH_DATA_UPDATE);
305305
}
306306

307-
const configUpdated = Utils.isDeepEqual(nextProps.config, this.state.config);
307+
const configUpdated = !Utils.isDeepEqual(nextProps.config, this.state.config);
308308
const state = newGraphElements ? this._initializeGraphState(nextProps.data) : this.state;
309309
const config = Utils.merge(DEFAULT_CONFIG, nextProps.config || {});
310310

src/components/Node/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import CONST from './const';
1212
* of d3 symbol.<br/>
1313
* {@link https://github.com/d3/d3-shape/blob/master/README.md#symbol}
1414
* @param {string} typeName - the string that specifies the symbol type (should be one of {@link #node-symbol-type|node.symbolType}).
15-
* @return {Object} concrete instance of d3 symbol.
15+
* @return {Object} concrete instance of d3 symbol (defaults to circle).
1616
* @memberof Node/helper
1717
*/
1818
function _convertTypeToD3Symbol(typeName) {
@@ -32,7 +32,7 @@ function _convertTypeToD3Symbol(typeName) {
3232
case CONST.SYMBOLS.WYE:
3333
return d3.symbolWye;
3434
default:
35-
return d3.symbolTriangle;
35+
return d3.symbolCircle;
3636
}
3737
}
3838

0 commit comments

Comments
 (0)