diff --git a/client/app/scripts/charts/nodes-chart.js b/client/app/scripts/charts/nodes-chart.js
index e200efe1f..fcbc60a8d 100644
--- a/client/app/scripts/charts/nodes-chart.js
+++ b/client/app/scripts/charts/nodes-chart.js
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import NodesChartElements from './nodes-chart-elements';
import ZoomableCanvas from '../components/zoomable-canvas';
+import { transformToString } from '../utils/transform-utils';
import { clickBackground } from '../actions/app-actions';
import {
graphZoomLimitsSelector,
@@ -43,17 +44,24 @@ class NodesChart extends React.Component {
}
}
+ renderContent(transform) {
+ return (
+
+
+
+
+ );
+ }
+
render() {
- const { selectedNodeId } = this.props;
return (
-
-
+ disabled={this.props.selectedNodeId}>
+ {transform => this.renderContent(transform)}
);
diff --git a/client/app/scripts/components/nodes-resources.js b/client/app/scripts/components/nodes-resources.js
index 50f257ab3..28d91d182 100644
--- a/client/app/scripts/components/nodes-resources.js
+++ b/client/app/scripts/components/nodes-resources.js
@@ -39,8 +39,8 @@ class NodesResources extends React.Component {
return (
{transform => this.renderLayers(transform)}
diff --git a/client/app/scripts/components/zoomable-canvas.js b/client/app/scripts/components/zoomable-canvas.js
index 1f5264795..a37dca26a 100644
--- a/client/app/scripts/components/zoomable-canvas.js
+++ b/client/app/scripts/components/zoomable-canvas.js
@@ -1,4 +1,5 @@
import React from 'react';
+import classNames from 'classnames';
import { connect } from 'react-redux';
import { clamp, debounce, pick } from 'lodash';
import { fromJS } from 'immutable';
@@ -10,7 +11,6 @@ import Logo from '../components/logo';
import ZoomControl from '../components/zoom-control';
import { cacheZoomState } from '../actions/app-actions';
import { zoomFactor } from '../utils/zoom-utils';
-import { transformToString } from '../utils/transform-utils';
import { activeTopologyZoomCacheKeyPathSelector } from '../selectors/zooming';
import {
canvasMarginsSelector,
@@ -35,6 +35,7 @@ class ZoomableCanvas extends React.Component {
super(props, context);
this.state = {
+ isPanning: false,
minTranslateX: 0,
maxTranslateX: 0,
minTranslateY: 0,
@@ -50,16 +51,23 @@ class ZoomableCanvas extends React.Component {
this.debouncedCacheZoom = debounce(this.cacheZoom.bind(this), ZOOM_CACHE_DEBOUNCE_INTERVAL);
this.handleZoomControlAction = this.handleZoomControlAction.bind(this);
this.canChangeZoom = this.canChangeZoom.bind(this);
+
this.handleZoom = this.handleZoom.bind(this);
+ this.handlePanStart = this.handlePanStart.bind(this);
+ this.handlePanEnd = this.handlePanEnd.bind(this);
this.handlePan = this.handlePan.bind(this);
}
componentDidMount() {
- this.zoomRestored = false;
- this.svg = select('svg#canvas');
- this.drag = drag().on('drag', this.handlePan);
+ this.svg = select('.zoomable-canvas svg');
+ this.drag = drag()
+ .on('start', this.handlePanStart)
+ .on('end', this.handlePanEnd)
+ .on('drag', this.handlePan);
this.svg.call(this.drag);
+ this.zoomRestored = false;
+
this.updateZoomLimits(this.props);
this.restoreZoomState(this.props);
}
@@ -96,21 +104,14 @@ class ZoomableCanvas extends React.Component {
}
render() {
- // `forwardTransform` says whether the zoom transform is forwarded to the child
- // component. The advantage of that is more control rendering control in the
- // children, while the disadvantage is that it's slower, as all the children
- // get updated on every zoom/pan action.
- const { children, forwardTransform } = this.props;
- const transform = forwardTransform ? '' : transformToString(this.state);
+ const className = classNames({ panning: this.state.isPanning });
return (
-