diff --git a/package-lock.json b/package-lock.json index fc485517331..1620c109cab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3540,9 +3540,12 @@ "dev": true }, "fast-isnumeric": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/fast-isnumeric/-/fast-isnumeric-1.1.1.tgz", - "integrity": "sha1-V7gcB6PAnLnsO++cFhgYmS2JNkM=" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fast-isnumeric/-/fast-isnumeric-1.1.2.tgz", + "integrity": "sha512-D7zJht1+NZBBv4759yXn/CJFUNJpILdgdosPFN1AjqQn9TfQJqSeCZfu0SY4bwIlXuDhzkxKoQ8BOqdiXpVzvA==", + "requires": { + "is-string-blank": "^1.0.1" + } }, "fast-json-stable-stringify": { "version": "2.0.0", @@ -4767,9 +4770,8 @@ } }, "gl-scatter3d": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/gl-scatter3d/-/gl-scatter3d-1.0.12.tgz", - "integrity": "sha512-FoOSXeZGQB4fWFwGAV9iJ87B2Fnxkb0JOZOXKUSuqoUoO2OCobHVCYqPV5dQE0A3u8jQkgkje2kSMc2vWXNdwA==", + "version": "git://github.com/gl-vis/gl-scatter3d.git#8915d2ec6a89b7dc76e216487e82143dbc165c6f", + "from": "git://github.com/gl-vis/gl-scatter3d.git#8915d2ec6a89b7dc76e216487e82143dbc165c6f", "requires": { "gl-buffer": "^2.0.6", "gl-mat4": "^1.0.0", @@ -4777,6 +4779,7 @@ "gl-vao": "^1.1.2", "glsl-out-of-range": "^1.0.2", "glslify": "^6.1.0", + "is-string-blank": "^1.0.1", "typedarray-pool": "^1.0.2", "vectorize-text": "^3.0.0" } @@ -6021,6 +6024,11 @@ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, + "is-string-blank": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-string-blank/-/is-string-blank-1.0.1.tgz", + "integrity": "sha512-9H+ZBCVs3L9OYqv8nuUAzpcT9OTgMD1yAWrG7ihlnibdkbtB850heAmYWxHuXc4CHy4lKeK69tN+ny1K7gBIrw==" + }, "is-svg-path": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-svg-path/-/is-svg-path-1.0.2.tgz", diff --git a/package.json b/package.json index f67193c84df..d6a23056ffc 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "d3-force": "^1.0.6", "delaunay-triangulate": "^1.1.6", "es6-promise": "^3.0.2", - "fast-isnumeric": "^1.1.1", + "fast-isnumeric": "^1.1.2", "font-atlas-sdf": "^1.3.3", "gl-cone3d": "^1.2.0", "gl-contour2d": "^1.1.4", @@ -80,7 +80,7 @@ "gl-plot2d": "^1.3.1", "gl-plot3d": "^1.5.10", "gl-pointcloud2d": "^1.0.1", - "gl-scatter3d": "^1.0.12", + "gl-scatter3d": "^1.0.13", "gl-select-box": "^1.0.2", "gl-spikes2d": "^1.0.1", "gl-streamtube3d": "^1.1.0", diff --git a/test/image/baselines/gl3d_scatter3d-blank-text.png b/test/image/baselines/gl3d_scatter3d-blank-text.png new file mode 100644 index 00000000000..628099722e4 Binary files /dev/null and b/test/image/baselines/gl3d_scatter3d-blank-text.png differ diff --git a/test/image/mocks/gl3d_scatter3d-blank-text.json b/test/image/mocks/gl3d_scatter3d-blank-text.json new file mode 100644 index 00000000000..a8fa61e492a --- /dev/null +++ b/test/image/mocks/gl3d_scatter3d-blank-text.json @@ -0,0 +1,59 @@ +{ + "data": [ + { + "x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], + "y": [0,0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10], + + "type": "scatter3d", + "mode":"lines+text", + "line":{ "width": 5 } + }, + { + "x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], + "y": [1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10], + + "text": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], + + "type": "scatter3d", + "mode":"lines+text", + "line":{ "width": 5 } + }, + { + "x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], + "y": [2,2,2,2,2,2,2,2,2,2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10], + + "text": [0,1e-3,0.1,"A","B","C","D","E","F","G",null,"I",null,"K","L","M","N",{"text":"X", "value":10.01},"Y","Zzz"], + + "type": "scatter3d", + "mode":"lines+text", + "line":{ "width": 5 } + }, + { + "x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], + "y": [3,3,3,3,3,3,3,3,3,3,3, 3, 3, 3, 3, 3, 3, 3, 3, 3], + "z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10], + + "text": [0,0.0,-0,-0.0,"","0"," ","E","\n","G",null,"I",null,"K",null,null,null,"X"], + + "type": "scatter3d", + "mode":"lines+text", + "line":{ "width": 5 } + } + + ], + "layout": { + "title":"scatter3d lines with good/bad/no input texts (including undefined, null & blank variations) should be displayed well on WEBGL", + "width": 1200, + "height": 900, + "scene":{ + "camera":{ + "eye":{"x":-1.25,"y":1.25,"z":1.25}, + "center":{"x":0,"y":0,"z":0}, + "up":{"x":0,"y":0,"z":1} + } + } + } +} diff --git a/test/jasmine/tests/gl3d_plot_interact_test.js b/test/jasmine/tests/gl3d_plot_interact_test.js index 89d00c3ac11..52e79ce0bd3 100644 --- a/test/jasmine/tests/gl3d_plot_interact_test.js +++ b/test/jasmine/tests/gl3d_plot_interact_test.js @@ -510,6 +510,27 @@ describe('Test gl3d plots', function() { .then(done); }); + + it('@gl should avoid passing blank texts to webgl', function(done) { + function assertIsFilled(msg) { + var fullLayout = gd._fullLayout; + expect(fullLayout.scene._scene.glplot.objects[0].glyphBuffer.length).not.toBe(0, msg); + } + + Plotly.plot(gd, [{ + type: 'scatter3d', + mode: 'text', + x: [1, 2, 3], + y: [2, 3, 1], + z: [3, 1, 2] + }]) + .then(function() { + assertIsFilled('not to be empty text'); + }) + .catch(failTest) + .then(done); + }); + }); describe('Test gl3d modebar handlers', function() {