@@ -4291,7 +4291,7 @@ d3 = function() {
42914291 return triangles ;
42924292 } ;
42934293 d3 . geom . voronoi = function ( points ) {
4294- var size = null , x = d3_svg_lineX , y = d3_svg_lineY , clip ;
4294+ var x = d3_svg_lineX , y = d3_svg_lineY , clipPolygon = null ;
42954295 if ( arguments . length ) return voronoi ( points ) ;
42964296 function voronoi ( data ) {
42974297 var points , polygons = data . map ( function ( ) {
@@ -4358,7 +4358,7 @@ d3 = function() {
43584358 }
43594359 }
43604360 } ) ;
4361- if ( clip ) for ( i = 0 ; i < n ; ++ i ) clip ( polygons [ i ] ) ;
4361+ if ( clipPolygon ) for ( i = 0 ; i < n ; ++ i ) clipPolygon . clip ( polygons [ i ] ) ;
43624362 for ( i = 0 ; i < n ; ++ i ) polygons [ i ] . point = data [ i ] ;
43634363 return polygons ;
43644364 }
@@ -4368,16 +4368,18 @@ d3 = function() {
43684368 voronoi . y = function ( _ ) {
43694369 return arguments . length ? ( y = _ , voronoi ) : y ;
43704370 } ;
4371- voronoi . size = function ( _ ) {
4372- if ( ! arguments . length ) return size ;
4373- if ( _ == null ) {
4374- clip = null ;
4375- } else {
4376- size = [ + _ [ 0 ] , + _ [ 1 ] ] ;
4377- clip = d3 . geom . polygon ( [ [ 0 , 0 ] , [ 0 , size [ 1 ] ] , size , [ size [ 0 ] , 0 ] ] ) . clip ;
4371+ voronoi . clipExtent = function ( _ ) {
4372+ if ( ! arguments . length ) return clipPolygon && [ clipPolygon [ 0 ] , clipPolygon [ 2 ] ] ;
4373+ if ( _ == null ) clipPolygon = null ; else {
4374+ var x1 = + _ [ 0 ] [ 0 ] , y1 = + _ [ 0 ] [ 1 ] , x2 = + _ [ 1 ] [ 0 ] , y2 = + _ [ 1 ] [ 1 ] ;
4375+ clipPolygon = d3 . geom . polygon ( [ [ x1 , y1 ] , [ x1 , y2 ] , [ x2 , y2 ] , [ x2 , y1 ] ] ) ;
43784376 }
43794377 return voronoi ;
43804378 } ;
4379+ voronoi . size = function ( _ ) {
4380+ if ( ! arguments . length ) return clipPolygon && clipPolygon [ 2 ] ;
4381+ return voronoi . clipExtent ( _ && [ [ 0 , 0 ] , _ ] ) ;
4382+ } ;
43814383 voronoi . links = function ( data ) {
43824384 var points , graph = data . map ( function ( ) {
43834385 return [ ] ;
0 commit comments