Skip to content

Commit 4f98430

Browse files
committed
Comments out bindZoomListener until refactored
1 parent 7d5a18a commit 4f98430

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

src/Tree/index.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PropTypes } from 'react';
22
import { TransitionGroup } from 'react-transition-group';
3-
import { layout, behavior, event, select } from 'd3';
3+
import { layout } from 'd3';
44
import clone from 'clone';
55
import uuid from 'uuid';
66

@@ -24,8 +24,6 @@ export default class Tree extends React.Component {
2424

2525

2626
componentDidMount() {
27-
this.bindZoomListener();
28-
2927
// TODO find better way of setting initialDepth, re-render here is suboptimal
3028
this.setState({ initialRender: false }); // eslint-disable-line
3129
}
@@ -56,27 +54,28 @@ export default class Tree extends React.Component {
5654
}
5755

5856

57+
// TODO Refactor zoom functionality & reimplement
5958
/**
6059
* bindZoomListener - If `props.zoomable`, binds a listener for
6160
* "zoom" events to the SVG and sets scaleExtent to min/max
6261
* specified in `props.scaleExtent`.
6362
*
6463
* @return {void}
6564
*/
66-
bindZoomListener() {
67-
const { zoomable, scaleExtent } = this.props;
68-
const svg = select('.svg');
69-
70-
if (zoomable) {
71-
this.setState({ zoom: 'scale(1)' });
72-
svg.call(behavior.zoom()
73-
.scaleExtent([scaleExtent.min, scaleExtent.max])
74-
.on('zoom', () => {
75-
this.setState({ zoom: `scale(${event.scale})` });
76-
})
77-
);
78-
}
79-
}
65+
// bindZoomListener() {
66+
// const { zoomable, scaleExtent } = this.props;
67+
// const svg = select('.svg');
68+
//
69+
// if (zoomable) {
70+
// this.setState({ zoom: 'scale(1)' });
71+
// svg.call(behavior.zoom()
72+
// .scaleExtent([scaleExtent.min, scaleExtent.max])
73+
// .on('zoom', () => {
74+
// this.setState({ zoom: `scale(${event.scale})` });
75+
// })
76+
// );
77+
// }
78+
// }
8079

8180

8281
/**
@@ -260,8 +259,8 @@ Tree.defaultProps = {
260259
depthFactor: undefined,
261260
collapsible: true,
262261
initialDepth: undefined,
263-
zoomable: true,
264-
scaleExtent: { min: 0.1, max: 1 },
262+
// zoomable: true,
263+
// scaleExtent: { min: 0.1, max: 1 },
265264
};
266265

267266
Tree.propTypes = {
@@ -282,9 +281,9 @@ Tree.propTypes = {
282281
depthFactor: PropTypes.number,
283282
collapsible: PropTypes.bool,
284283
initialDepth: PropTypes.number,
285-
zoomable: PropTypes.bool,
286-
scaleExtent: PropTypes.shape({
287-
min: PropTypes.number,
288-
max: PropTypes.number,
289-
}),
284+
// zoomable: PropTypes.bool,
285+
// scaleExtent: PropTypes.shape({
286+
// min: PropTypes.number,
287+
// max: PropTypes.number,
288+
// }),
290289
};

0 commit comments

Comments
 (0)