Skip to content

Commit f67b40c

Browse files
committed
handle typed arrays in gl-axes3d
1 parent 09f4dd3 commit f67b40c

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

stackgl_modules/index.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -11905,6 +11905,17 @@ var identity = new Float32Array([
1190511905
0, 0, 1, 0,
1190611906
0, 0, 0, 1])
1190711907

11908+
var ab = ArrayBuffer
11909+
var dv = DataView
11910+
11911+
function isTypedArray(a) {
11912+
return ab.isView(a) && !(a instanceof dv)
11913+
}
11914+
11915+
function isArrayOrTypedArray(a) {
11916+
return Array.isArray(a) || isTypedArray(a)
11917+
}
11918+
1190811919
function copyVec3(a, b) {
1190911920
a[0] = b[0]
1191011921
a[1] = b[1]
@@ -11992,8 +12003,8 @@ proto.update = function(options) {
1199212003
var opt = options[name]
1199312004
var prev = this[name]
1199412005
var next
11995-
if(nest ? (Array.isArray(opt) && Array.isArray(opt[0])) :
11996-
Array.isArray(opt) ) {
12006+
if(nest ? (isArrayOrTypedArray(opt) && isArrayOrTypedArray(opt[0])) :
12007+
isArrayOrTypedArray(opt) ) {
1199712008
this[name] = next = [ cons(opt[0]), cons(opt[1]), cons(opt[2]) ]
1199812009
} else {
1199912010
this[name] = next = [ cons(opt), cons(opt), cons(opt) ]
@@ -12011,7 +12022,7 @@ proto.update = function(options) {
1201112022
var BOOLEAN = parseOption.bind(this, false, Boolean)
1201212023
var STRING = parseOption.bind(this, false, String)
1201312024
var COLOR = parseOption.bind(this, true, function(v) {
12014-
if(Array.isArray(v)) {
12025+
if(isArrayOrTypedArray(v)) {
1201512026
if(v.length === 3) {
1201612027
return [ +v[0], +v[1], +v[2], 1.0 ]
1201712028
} else if(v.length === 4) {

stackgl_modules/package-lock.json

+8-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stackgl_modules/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"box-intersect": "plotly/box-intersect#v1.1.0",
1414
"convex-hull": "^1.0.3",
1515
"delaunay-triangulate": "^1.1.6",
16-
"gl-axes3d": "^1.6.0",
16+
"gl-axes3d": "github:gl-vis/gl-axes3d#6947ff3a786fd225e66a9e61551ad79ba6df25bf",
1717
"gl-cone3d": "^1.6.0",
1818
"gl-error3d": "^1.0.16",
1919
"gl-heatmap2d": "^1.1.1",

0 commit comments

Comments
 (0)