Skip to content

Commit

Permalink
Fix/default node symbol (#11)
Browse files Browse the repository at this point in the history
* Fix default node symbol (:circle: it is)

* Call onPauseSimulation instead

* Call _tick instead. :bug: in configUpdated flag
  • Loading branch information
danielcaldas committed Aug 4, 2017
1 parent bab2c93 commit 204369a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/components/Graph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class Graph extends React.Component {
/**
* Handles d3 drag 'start' event.
*/
_onDragStart = () => !this.state.config.staticGraph && this.state.simulation.stop();
_onDragStart = () => this.pauseSimulation();

/**
* Sets nodes and links highlighted value.
Expand All @@ -120,7 +120,7 @@ export default class Graph extends React.Component {
});
}

this.setState(this.state || {});
this._tick();
}

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

this.setState(this.state || {});
this._tick();
}
}

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/components/Node/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CONST from './const';
* of d3 symbol.<br/>
* {@link https://github.com/d3/d3-shape/blob/master/README.md#symbol}
* @param {string} typeName - the string that specifies the symbol type (should be one of {@link #node-symbol-type|node.symbolType}).
* @return {Object} concrete instance of d3 symbol.
* @return {Object} concrete instance of d3 symbol (defaults to circle).
* @memberof Node/helper
*/
function _convertTypeToD3Symbol(typeName) {
Expand All @@ -32,7 +32,7 @@ function _convertTypeToD3Symbol(typeName) {
case CONST.SYMBOLS.WYE:
return d3.symbolWye;
default:
return d3.symbolTriangle;
return d3.symbolCircle;
}
}

Expand Down

0 comments on commit 204369a

Please sign in to comment.