@@ -90,6 +90,7 @@ class App extends Component {
90
90
initialDepth : 1 ,
91
91
depthFactor : undefined ,
92
92
zoomable : true ,
93
+ draggable : true ,
93
94
zoom : 1 ,
94
95
scaleExtent : { min : 0.1 , max : 1 } ,
95
96
separation : { siblings : 2 , nonSiblings : 2 } ,
@@ -127,6 +128,7 @@ class App extends Component {
127
128
this . handleFloatChange = this . handleFloatChange . bind ( this ) ;
128
129
this . toggleCollapsible = this . toggleCollapsible . bind ( this ) ;
129
130
this . toggleZoomable = this . toggleZoomable . bind ( this ) ;
131
+ this . toggleDraggable = this . toggleDraggable . bind ( this ) ;
130
132
this . toggleCenterNodes = this . toggleCenterNodes . bind ( this ) ;
131
133
this . setScaleExtent = this . setScaleExtent . bind ( this ) ;
132
134
this . setSeparation = this . setSeparation . bind ( this ) ;
@@ -203,6 +205,10 @@ class App extends Component {
203
205
this . setState ( prevState => ( { zoomable : ! prevState . zoomable } ) ) ;
204
206
}
205
207
208
+ toggleDraggable ( ) {
209
+ this . setState ( prevState => ( { draggable : ! prevState . draggable } ) ) ;
210
+ }
211
+
206
212
toggleCenterNodes ( ) {
207
213
if ( this . state . dimensions !== undefined ) {
208
214
this . setState ( {
@@ -414,6 +420,15 @@ class App extends Component {
414
420
/>
415
421
</ div >
416
422
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
+
417
432
< div className = "prop-container" >
418
433
< h4 className = "prop" >
419
434
Center Nodes on Click (via < code > dimensions</ code > prop)
@@ -662,6 +677,7 @@ class App extends Component {
662
677
collapsible = { this . state . collapsible }
663
678
initialDepth = { this . state . initialDepth }
664
679
zoomable = { this . state . zoomable }
680
+ draggable = { this . state . draggable }
665
681
zoom = { this . state . zoom }
666
682
scaleExtent = { this . state . scaleExtent }
667
683
nodeSize = { this . state . nodeSize }
0 commit comments