File tree 2 files changed +9
-10
lines changed
2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
var tinycolor = require ( 'tinycolor2' ) ;
4
4
var isNumeric = require ( 'fast-isnumeric' ) ;
5
+ var isTypedArray = require ( '../../lib/array' ) . isTypedArray ;
5
6
6
7
var color = module . exports = { } ;
7
8
@@ -116,7 +117,7 @@ color.clean = function(container) {
116
117
if ( ! Array . isArray ( el0 ) && el0 && typeof el0 === 'object' ) {
117
118
for ( j = 0 ; j < val . length ; j ++ ) color . clean ( val [ j ] ) ;
118
119
}
119
- } else if ( val && typeof val === 'object' ) color . clean ( val ) ;
120
+ } else if ( val && typeof val === 'object' && ! isTypedArray ( val ) ) color . clean ( val ) ;
120
121
}
121
122
} ;
122
123
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ module.exports = function calc(gd, trace) {
27
27
var hasTooManyPoints = len >= TOO_MANY_POINTS ;
28
28
var len2 = len * 2 ;
29
29
var stash = { } ;
30
- var i , xx , yy ;
30
+ var i ;
31
31
32
32
var origX = xa . makeCalcdata ( trace , 'x' ) ;
33
33
var origY = ya . makeCalcdata ( trace , 'y' ) ;
@@ -42,11 +42,12 @@ module.exports = function calc(gd, trace) {
42
42
// we need hi-precision for scatter2d,
43
43
// regl-scatter2d uses NaNs for bad/missing values
44
44
var positions = new Array ( len2 ) ;
45
+ var _ids = new Array ( len ) ;
45
46
for ( i = 0 ; i < len ; i ++ ) {
46
- xx = x [ i ] ;
47
- yy = y [ i ] ;
48
- positions [ i * 2 ] = xx === BADNUM ? NaN : xx ;
49
- positions [ i * 2 + 1 ] = yy === BADNUM ? NaN : yy ;
47
+ positions [ i * 2 ] = x [ i ] === BADNUM ? NaN : x [ i ] ;
48
+ positions [ i * 2 + 1 ] = y [ i ] === BADNUM ? NaN : y [ i ] ;
49
+ // Pre-compute ids.
50
+ _ids [ i ] = i ;
50
51
}
51
52
52
53
if ( xa . type === 'log' ) {
@@ -66,10 +67,7 @@ module.exports = function calc(gd, trace) {
66
67
// FIXME: delegate this to webworker
67
68
stash . tree = cluster ( positions ) ;
68
69
} else {
69
- var ids = stash . ids = new Array ( len ) ;
70
- for ( i = 0 ; i < len ; i ++ ) {
71
- ids [ i ] = i ;
72
- }
70
+ stash . ids = _ids ;
73
71
}
74
72
75
73
// create scene options and scene
You can’t perform that action at this time.
0 commit comments