1
1
import React , { PropTypes } from 'react' ;
2
2
import { TransitionGroup } from 'react-transition-group' ;
3
- import { layout , behavior , event , select } from 'd3' ;
3
+ import { layout } from 'd3' ;
4
4
import clone from 'clone' ;
5
5
import uuid from 'uuid' ;
6
6
@@ -24,8 +24,6 @@ export default class Tree extends React.Component {
24
24
25
25
26
26
componentDidMount ( ) {
27
- this . bindZoomListener ( ) ;
28
-
29
27
// TODO find better way of setting initialDepth, re-render here is suboptimal
30
28
this . setState ( { initialRender : false } ) ; // eslint-disable-line
31
29
}
@@ -56,27 +54,28 @@ export default class Tree extends React.Component {
56
54
}
57
55
58
56
57
+ // TODO Refactor zoom functionality & reimplement
59
58
/**
60
59
* bindZoomListener - If `props.zoomable`, binds a listener for
61
60
* "zoom" events to the SVG and sets scaleExtent to min/max
62
61
* specified in `props.scaleExtent`.
63
62
*
64
63
* @return {void }
65
64
*/
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
+ // }
80
79
81
80
82
81
/**
@@ -260,8 +259,8 @@ Tree.defaultProps = {
260
259
depthFactor : undefined ,
261
260
collapsible : true ,
262
261
initialDepth : undefined ,
263
- zoomable : true ,
264
- scaleExtent : { min : 0.1 , max : 1 } ,
262
+ // zoomable: true,
263
+ // scaleExtent: { min: 0.1, max: 1 },
265
264
} ;
266
265
267
266
Tree . propTypes = {
@@ -282,9 +281,9 @@ Tree.propTypes = {
282
281
depthFactor : PropTypes . number ,
283
282
collapsible : PropTypes . bool ,
284
283
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
+ // }),
290
289
} ;
0 commit comments