@@ -65,28 +65,33 @@ module.exports = function draw(gd, id) {
65
65
return ;
66
66
}
67
67
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 ;
76
77
77
78
var l0 = opts . levels . end + opts . levels . size / 100 ,
78
79
ls = opts . levels . size ,
79
80
zr0 = ( 1.001 * zrange [ 0 ] - 0.001 * zrange [ 1 ] ) ,
80
81
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 ;
82
85
if ( l > zr0 && l < zr1 ) linelevels . push ( l ) ;
83
86
}
84
87
85
88
if ( typeof opts . fillcolor === 'function' ) {
86
89
if ( opts . filllevels ) {
87
90
l0 = opts . filllevels . end + opts . filllevels . size / 100 ;
88
91
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 ;
90
95
if ( l > zrange [ 0 ] && l < zrange [ 1 ] ) filllevels . push ( l ) ;
91
96
}
92
97
}
0 commit comments