@@ -65,28 +65,33 @@ module.exports = function draw(gd, id) {
6565 return ;
6666 }
6767 var zrange = d3 . extent ( ( ( typeof opts . fillcolor === 'function' ) ?
68- opts . fillcolor : opts . line . color ) . domain ( ) ) ,
69- linelevels = [ ] ,
70- filllevels = [ ] ,
71- l ,
72- linecolormap = typeof opts . line . color === 'function' ?
73- opts . line . color : function ( ) { return opts . line . color ; } ,
74- fillcolormap = typeof opts . fillcolor === 'function' ?
75- opts . fillcolor : function ( ) { return opts . fillcolor ; } ;
68+ opts . fillcolor : opts . line . color ) . domain ( ) ) ;
69+ var linelevels = [ ] ;
70+ var filllevels = [ ] ;
71+ var linecolormap = typeof opts . line . color === 'function' ?
72+ opts . line . color : function ( ) { return opts . line . color ; } ;
73+ var fillcolormap = typeof opts . fillcolor === 'function' ?
74+ opts . fillcolor : function ( ) { return opts . fillcolor ; } ;
75+ var l ;
76+ var i ;
7677
7778 var l0 = opts . levels . end + opts . levels . size / 100 ,
7879 ls = opts . levels . size ,
7980 zr0 = ( 1.001 * zrange [ 0 ] - 0.001 * zrange [ 1 ] ) ,
8081 zr1 = ( 1.001 * zrange [ 1 ] - 0.001 * zrange [ 0 ] ) ;
81- for ( l = opts . levels . start ; ( l - l0 ) * ls < 0 ; l += ls ) {
82+ for ( i = 0 ; i < 1e5 ; i ++ ) {
83+ l = opts . levels . start + i * ls ;
84+ if ( ls > 0 ? ( l >= l0 ) : ( l <= l0 ) ) break ;
8285 if ( l > zr0 && l < zr1 ) linelevels . push ( l ) ;
8386 }
8487
8588 if ( typeof opts . fillcolor === 'function' ) {
8689 if ( opts . filllevels ) {
8790 l0 = opts . filllevels . end + opts . filllevels . size / 100 ;
8891 ls = opts . filllevels . size ;
89- for ( l = opts . filllevels . start ; ( l - l0 ) * ls < 0 ; l += ls ) {
92+ for ( i = 0 ; i < 1e5 ; i ++ ) {
93+ l = opts . filllevels . start + i * ls ;
94+ if ( ls > 0 ? ( l >= l0 ) : ( l <= l0 ) ) break ;
9095 if ( l > zrange [ 0 ] && l < zrange [ 1 ] ) filllevels . push ( l ) ;
9196 }
9297 }
0 commit comments