File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ class TreeBuilder {
1616 var allNodes = this . allNodes ;
1717 var nodeSize = this . nodeSize ;
1818
19+ var width = opts . width + opts . margin . left + opts . margin . right ;
20+ var height = opts . height + opts . margin . top + opts . margin . bottom ;
21+
1922 var zoom = d3 . behavior . zoom ( )
2023 . scaleExtent ( [ 0.1 , 10 ] )
2124 . on ( 'zoom' , _ . bind ( function ( ) {
@@ -26,11 +29,11 @@ class TreeBuilder {
2629 //make an SVG
2730 var svg = this . svg = d3 . select ( opts . target )
2831 . append ( 'svg' )
29- . attr ( 'width' , opts . width + opts . margin . left + opts . margin . right )
30- . attr ( 'height' , opts . height + opts . margin . top + opts . margin . bottom )
32+ . attr ( 'width' , width )
33+ . attr ( 'height' , height )
3134 . call ( zoom )
3235 . append ( 'g' )
33- . attr ( 'transform' , 'translate(' + opts . margin . left + ',' + opts . margin . top + ')' ) ;
36+ . attr ( 'transform' , 'translate(' + width / 2 + ',' + opts . margin . top + ')' ) ;
3437
3538 // Compute the layout.
3639 this . tree = d3 . layout . tree ( )
You can’t perform that action at this time.
0 commit comments