File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 22
33var tinycolor = require ( 'tinycolor2' ) ;
44var isNumeric = require ( 'fast-isnumeric' ) ;
5+ var isTypedArray = require ( '../../lib/array' ) . isTypedArray ;
56
67var color = module . exports = { } ;
78
@@ -116,7 +117,7 @@ color.clean = function(container) {
116117 if ( ! Array . isArray ( el0 ) && el0 && typeof el0 === 'object' ) {
117118 for ( j = 0 ; j < val . length ; j ++ ) color . clean ( val [ j ] ) ;
118119 }
119- } else if ( val && typeof val === 'object' ) color . clean ( val ) ;
120+ } else if ( val && typeof val === 'object' && ! isTypedArray ( val ) ) color . clean ( val ) ;
120121 }
121122} ;
122123
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ module.exports = function calc(gd, trace) {
2727 var hasTooManyPoints = len >= TOO_MANY_POINTS ;
2828 var len2 = len * 2 ;
2929 var stash = { } ;
30- var i , xx , yy ;
30+ var i ;
3131
3232 var origX = xa . makeCalcdata ( trace , 'x' ) ;
3333 var origY = ya . makeCalcdata ( trace , 'y' ) ;
@@ -42,11 +42,12 @@ module.exports = function calc(gd, trace) {
4242 // we need hi-precision for scatter2d,
4343 // regl-scatter2d uses NaNs for bad/missing values
4444 var positions = new Array ( len2 ) ;
45+ var _ids = new Array ( len ) ;
4546 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 ;
5051 }
5152
5253 if ( xa . type === 'log' ) {
@@ -66,10 +67,7 @@ module.exports = function calc(gd, trace) {
6667 // FIXME: delegate this to webworker
6768 stash . tree = cluster ( positions ) ;
6869 } 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 ;
7371 }
7472
7573 // create scene options and scene
You can’t perform that action at this time.
0 commit comments