@@ -3126,19 +3126,21 @@ define('zrender/tool/color',['require','../core/LRU'],function(require) {
3126
3126
}
3127
3127
3128
3128
/**
3129
- * Map value to color. Faster than mapToColor methods because color is represented by rgba array
3129
+ * Map value to color. Faster than mapToColor methods because color is represented by rgba array.
3130
3130
* @param {number } normalizedValue A float between 0 and 1.
3131
3131
* @param {Array.<Array.<number>> } colors List of rgba color array
3132
3132
* @param {Array.<number> } [out] Mapped gba color array
3133
- * @return {Array.<number> }
3133
+ * @return {Array.<number> } will be null/undefined if input illegal.
3134
3134
*/
3135
3135
function fastMapToColor ( normalizedValue , colors , out ) {
3136
- out = out || [ 0 , 0 , 0 , 0 ] ;
3137
3136
if ( ! ( colors && colors . length )
3138
3137
|| ! ( normalizedValue >= 0 && normalizedValue <= 1 )
3139
3138
) {
3140
- return out ;
3139
+ return ;
3141
3140
}
3141
+
3142
+ out = out || [ ] ;
3143
+
3142
3144
var value = normalizedValue * ( colors . length - 1 ) ;
3143
3145
var leftIndex = Math . floor ( value ) ;
3144
3146
var rightIndex = Math . ceil ( value ) ;
@@ -3149,6 +3151,7 @@ define('zrender/tool/color',['require','../core/LRU'],function(require) {
3149
3151
out [ 1 ] = clampCssByte ( lerp ( leftColor [ 1 ] , rightColor [ 1 ] , dv ) ) ;
3150
3152
out [ 2 ] = clampCssByte ( lerp ( leftColor [ 2 ] , rightColor [ 2 ] , dv ) ) ;
3151
3153
out [ 3 ] = clampCssFloat ( lerp ( leftColor [ 3 ] , rightColor [ 3 ] , dv ) ) ;
3154
+
3152
3155
return out ;
3153
3156
}
3154
3157
/**
@@ -3230,12 +3233,12 @@ define('zrender/tool/color',['require','../core/LRU'],function(require) {
3230
3233
}
3231
3234
3232
3235
/**
3233
- * @param {Array.<string > } colors Color list.
3236
+ * @param {Array.<number > } arrColor like [12,33,44,0.4]
3234
3237
* @param {string } type 'rgba', 'hsva', ...
3235
3238
* @return {string } Result color. (If input illegal, return undefined).
3236
3239
*/
3237
3240
function stringify ( arrColor , type ) {
3238
- if ( ! arrColor ) {
3241
+ if ( ! arrColor || ! arrColor . length ) {
3239
3242
return ;
3240
3243
}
3241
3244
var colorStr = arrColor [ 0 ] + ',' + arrColor [ 1 ] + ',' + arrColor [ 2 ] ;
@@ -9426,7 +9429,7 @@ define('zrender/zrender',['require','./core/guid','./core/env','./core/util','./
9426
9429
/**
9427
9430
* @type {string }
9428
9431
*/
9429
- zrender . version = '3.4.1 ' ;
9432
+ zrender . version = '3.4.2 ' ;
9430
9433
9431
9434
/**
9432
9435
* Initializing a zrender instance
0 commit comments