diff --git a/client/app/scripts/charts/nodes-chart.js b/client/app/scripts/charts/nodes-chart.js
index f876206b2..0a4714c76 100644
--- a/client/app/scripts/charts/nodes-chart.js
+++ b/client/app/scripts/charts/nodes-chart.js
@@ -21,7 +21,7 @@ const MARGINS = {
// make sure circular layouts a bit denser with 3-6 nodes
const radiusDensity = d3.scale.threshold()
- .domain([3, 6]).range([3, 4, 3]);
+ .domain([3, 6]).range([2.5, 3.5, 3]);
const NodesChart = React.createClass({
@@ -30,7 +30,7 @@ const NodesChart = React.createClass({
nodes: {},
edges: {},
nodeScale: d3.scale.linear(),
- translate: [0, 0],
+ shiftTranslate: [0, 0],
panTranslate: [0, 0],
scale: 1,
hasZoomed: false,
@@ -49,8 +49,7 @@ const NodesChart = React.createClass({
.scaleExtent([0.1, 2])
.on('zoom', this.zoomed);
- d3.select('.canvas')
- .on('click', this.handleBackgroundClick)
+ d3.select('.nodes-chart svg')
.call(this.zoom);
},
@@ -61,6 +60,7 @@ const NodesChart = React.createClass({
// wipe node states when showing different topology
if (nextProps.topologyId !== this.props.topologyId) {
_.assign(state, {
+ autoShifted: false,
nodes: {},
edges: {}
});
@@ -82,8 +82,7 @@ const NodesChart = React.createClass({
componentWillUnmount: function() {
// undoing .call(zoom)
- d3.select('.canvas')
- .on('click', null)
+ d3.select('.nodes-chart svg')
.on('mousedown.zoom', null)
.on('onwheel', null)
.on('onmousewheel', null)
@@ -159,7 +158,7 @@ const NodesChart = React.createClass({
// only animate shift behavior, not panning
const panTranslate = this.state.panTranslate;
- const shiftTranslate = this.state.translate;
+ const shiftTranslate = this.state.shiftTranslate;
let translate = panTranslate;
let wasShifted = false;
if (shiftTranslate[0] !== panTranslate[0] || shiftTranslate[1] !== panTranslate[1]) {
@@ -175,7 +174,7 @@ const NodesChart = React.createClass({
Too many nodes to show in the browser.
We're working on it, but for now, try a different view?
-