@@ -90,6 +90,7 @@ class App extends Component {
9090 initialDepth : 1 ,
9191 depthFactor : undefined ,
9292 zoomable : true ,
93+ draggable : true ,
9394 zoom : 1 ,
9495 scaleExtent : { min : 0.1 , max : 1 } ,
9596 separation : { siblings : 2 , nonSiblings : 2 } ,
@@ -127,6 +128,7 @@ class App extends Component {
127128 this . handleFloatChange = this . handleFloatChange . bind ( this ) ;
128129 this . toggleCollapsible = this . toggleCollapsible . bind ( this ) ;
129130 this . toggleZoomable = this . toggleZoomable . bind ( this ) ;
131+ this . toggleDraggable = this . toggleDraggable . bind ( this ) ;
130132 this . toggleCenterNodes = this . toggleCenterNodes . bind ( this ) ;
131133 this . setScaleExtent = this . setScaleExtent . bind ( this ) ;
132134 this . setSeparation = this . setSeparation . bind ( this ) ;
@@ -203,6 +205,10 @@ class App extends Component {
203205 this . setState ( prevState => ( { zoomable : ! prevState . zoomable } ) ) ;
204206 }
205207
208+ toggleDraggable ( ) {
209+ this . setState ( prevState => ( { draggable : ! prevState . draggable } ) ) ;
210+ }
211+
206212 toggleCenterNodes ( ) {
207213 if ( this . state . dimensions !== undefined ) {
208214 this . setState ( {
@@ -414,6 +420,15 @@ class App extends Component {
414420 />
415421 </ div >
416422
423+ < div className = "prop-container" >
424+ < h4 className = "prop" > Draggable</ h4 >
425+ < Switch
426+ name = "draggableBtn"
427+ checked = { this . state . draggable }
428+ onChange = { this . toggleDraggable }
429+ />
430+ </ div >
431+
417432 < div className = "prop-container" >
418433 < h4 className = "prop" >
419434 Center Nodes on Click (via < code > dimensions</ code > prop)
@@ -662,6 +677,7 @@ class App extends Component {
662677 collapsible = { this . state . collapsible }
663678 initialDepth = { this . state . initialDepth }
664679 zoomable = { this . state . zoomable }
680+ draggable = { this . state . draggable }
665681 zoom = { this . state . zoom }
666682 scaleExtent = { this . state . scaleExtent }
667683 nodeSize = { this . state . nodeSize }
0 commit comments