@@ -1127,7 +1127,7 @@ d3 = function() {
11271127 return d3 . rebind ( drag , event , "on" ) ;
11281128 } ;
11291129 d3 . behavior . zoom = function ( ) {
1130- var translate = [ 0 , 0 ] , translate0 , scale = 1 , distance0 , scale0 , scaleExtent = d3_behavior_zoomInfinity , event = d3_eventDispatch ( zoom , "zoom" ) , x0 , x1 , y0 , y1 , touchtime ;
1130+ var translate = [ 0 , 0 ] , translate0 , scale = 1 , distance0 , scale0 , scaleExtent = d3_behavior_zoomInfinity , center , event = d3_eventDispatch ( zoom , "zoom" ) , x0 , x1 , y0 , y1 , touchtime ;
11311131 function zoom ( ) {
11321132 this . on ( "mousedown.zoom" , mousedown ) . on ( "mousemove.zoom" , mousemove ) . on ( d3_behavior_zoomWheel + ".zoom" , mousewheel ) . on ( "dblclick.zoom" , dblclick ) . on ( "touchstart.zoom" , touchstart ) . on ( "touchmove.zoom" , touchmove ) . on ( "touchend.zoom" , touchstart ) ;
11331133 }
@@ -1148,6 +1148,11 @@ d3 = function() {
11481148 scaleExtent = x == null ? d3_behavior_zoomInfinity : x . map ( Number ) ;
11491149 return zoom ;
11501150 } ;
1151+ zoom . center = function ( _ ) {
1152+ if ( ! arguments . length ) return center ;
1153+ center = _ && _ . map ( Number ) ;
1154+ return zoom ;
1155+ } ;
11511156 zoom . x = function ( z ) {
11521157 if ( ! arguments . length ) return x1 ;
11531158 x1 = z ;
@@ -1208,9 +1213,10 @@ d3 = function() {
12081213 }
12091214 }
12101215 function mousewheel ( ) {
1211- if ( ! translate0 ) translate0 = location ( d3 . mouse ( this ) ) ;
1216+ var point = center || d3 . mouse ( this ) ;
1217+ if ( ! translate0 ) translate0 = location ( point ) ;
12121218 scaleTo ( Math . pow ( 2 , d3_behavior_zoomDelta ( ) * .002 ) * scale ) ;
1213- translateTo ( d3 . mouse ( this ) , translate0 ) ;
1219+ translateTo ( point , translate0 ) ;
12141220 dispatch ( event . of ( this , arguments ) ) ;
12151221 }
12161222 function mousemove ( ) {
0 commit comments