mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-19 04:16:21 +00:00
Fix panning isolation
* panning values were reused on when visiting a topology for the first time Fixes #1238
This commit is contained in:
committed by
Tom Wilkie
parent
8c4f025fa4
commit
4810bbc572
@@ -63,8 +63,9 @@ export default class NodesChart extends React.Component {
|
||||
|
||||
// wipe node states when showing different topology
|
||||
if (nextProps.topologyId !== this.props.topologyId) {
|
||||
// re-apply cached canvas zoom/pan to d3 behavior
|
||||
const nextZoom = this.state.zoomCache[nextProps.topologyId];
|
||||
// re-apply cached canvas zoom/pan to d3 behavior (or set defaul values)
|
||||
const defaultZoom = { scale: 1, panTranslateX: 0, panTranslateY: 0, hasZoomed: false };
|
||||
const nextZoom = this.state.zoomCache[nextProps.topologyId] || defaultZoom;
|
||||
if (nextZoom) {
|
||||
this.zoom.scale(nextZoom.scale);
|
||||
this.zoom.translate([nextZoom.panTranslateX, nextZoom.panTranslateY]);
|
||||
|
||||
Reference in New Issue
Block a user