diff --git a/package-lock.json b/package-lock.json index 381b502d49a..345de11a057 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", @@ -4763,15 +4766,16 @@ } }, "gl-scatter3d": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/gl-scatter3d/-/gl-scatter3d-1.0.11.tgz", - "integrity": "sha512-fKpIBm6QHuw3RVzM3fjYgpigQuHIDj5tXbbGx8whWIx7S3ureiZgTxsM2Mtwo+OLsm1lUEryGf2YbFf3NQ9CiQ==", + "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", "gl-shader": "^4.2.0", "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" } @@ -5050,6 +5054,11 @@ "resolved": "https://registry.npmjs.org/glsl-inverse/-/glsl-inverse-1.0.0.tgz", "integrity": "sha1-EsCx0GX1WERNHm/q95td34qRiuY=" }, + "glsl-out-of-range": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/glsl-out-of-range/-/glsl-out-of-range-1.0.2.tgz", + "integrity": "sha512-Qej48sfhSajxvfOmFNz5RV37DEHUjVTz38id1Y/Nt0kAXEe8IQSOXhKvlnD+uDpU5JKS6fLxlxLy8lJ/bepqAQ==" + }, "glsl-read-float": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/glsl-read-float/-/glsl-read-float-1.1.0.tgz", @@ -6009,6 +6018,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 56fb105d8cf..3f47709632f 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.1.0", "gl-contour2d": "^1.1.4", @@ -80,7 +80,7 @@ "gl-plot2d": "^1.3.1", "gl-plot3d": "^1.5.7", "gl-pointcloud2d": "^1.0.1", - "gl-scatter3d": "^1.0.11", + "gl-scatter3d": "git://github.com/gl-vis/gl-scatter3d.git#8915d2ec6a89b7dc76e216487e82143dbc165c6f", "gl-select-box": "^1.0.2", "gl-spikes2d": "^1.0.1", "gl-streamtube3d": "^1.0.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..e68d286a065 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() {