Skip to content

Commit c2a9e3f

Browse files
committed
bug fix issue 3387 by fixing pixelratio in various 3d modules and plotly.js side to work fine on iOS and FireFox
bug fix issue 3572 to preserve line widths in save 3d plots as image button as well as CI removed an unused ortho argument from plot_api subroutine improved ticks distances in orthographic views using latest gl-axes3d
1 parent 9ef8617 commit c2a9e3f

File tree

69 files changed

+48
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+48
-52
lines changed

package-lock.json

Lines changed: 18 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@
7272
"es6-promise": "^3.0.2",
7373
"fast-isnumeric": "^1.1.2",
7474
"font-atlas-sdf": "^1.3.3",
75-
"gl-cone3d": "^1.2.2",
75+
"gl-cone3d": "git://github.com/gl-vis/gl-cone3d.git#ec71aa87233d04b543ae53854c9a1182d40fc8ac",
7676
"gl-contour2d": "^1.1.5",
77-
"gl-error3d": "^1.0.13",
77+
"gl-error3d": "git://github.com/gl-vis/gl-error3d.git#75ec29dd1dde51a697f718cdacf76e36a7bfd38c",
7878
"gl-heatmap2d": "^1.0.5",
7979
"gl-line3d": "^1.1.10",
8080
"gl-mat4": "^1.2.0",
81-
"gl-mesh3d": "^2.0.7",
81+
"gl-mesh3d": "git://github.com/gl-vis/gl-mesh3d.git#31d34ba3cec063697cc3891e141532cd80d95ba3",
8282
"gl-plot2d": "^1.4.2",
83-
"gl-plot3d": "^2.0.0",
83+
"gl-plot3d": "git://github.com/gl-vis/gl-plot3d.git#3580a0eedd81b9f212186caa8e7018d8016274fe",
8484
"gl-pointcloud2d": "^1.0.2",
85-
"gl-scatter3d": "^1.1.6",
85+
"gl-scatter3d": "git://github.com/gl-vis/gl-scatter3d.git#6292ada845bdcd44a8e2db2d3c5e18c96c9ac210",
8686
"gl-select-box": "^1.0.3",
8787
"gl-spikes2d": "^1.0.2",
88-
"gl-streamtube3d": "^1.1.2",
89-
"gl-surface3d": "^1.4.1",
88+
"gl-streamtube3d": "git://github.com/gl-vis/gl-streamtube3d.git#ecdaa1dbbcd315ba06133aeccf870c98b993a8ae",
89+
"gl-surface3d": "git://github.com/gl-vis/gl-surface3d.git#96e61eebac18e9b525f7f3e6b714291b5d1b4bad",
9090
"gl-text": "^1.1.6",
9191
"glslify": "^7.0.0",
9292
"has-hover": "^1.0.1",

src/plot_api/subroutines.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,7 @@ exports.doCamera = function(gd) {
601601
var scene = sceneLayout._scene;
602602

603603
var cameraData = sceneLayout.camera;
604-
var isOrtho = !!(cameraData && cameraData.projection && cameraData.projection.type === 'orthographic');
605-
606-
scene.setCamera(cameraData, isOrtho);
604+
scene.setCamera(cameraData);
607605
}
608606
};
609607

src/plots/gl3d/scene.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function render(scene) {
192192
scene.drawAnnotations(scene);
193193
}
194194

195-
function tryCreatePlot(scene, camera, canvas, gl) {
195+
function tryCreatePlot(scene, camera, pixelRatio, canvas, gl) {
196196

197197
var glplotOptions = {
198198
canvas: canvas,
@@ -204,7 +204,8 @@ function tryCreatePlot(scene, camera, canvas, gl) {
204204
snapToData: true,
205205
autoScale: true,
206206
autoBounds: false,
207-
camera: camera
207+
camera: camera,
208+
pixelRatio: pixelRatio
208209
};
209210

210211
// for static plots, we reuse the WebGL context
@@ -237,9 +238,9 @@ function tryCreatePlot(scene, camera, canvas, gl) {
237238
return true;
238239
}
239240

240-
function initializeGLPlot(scene, camera, canvas, gl) {
241+
function initializeGLPlot(scene, camera, pixelRatio, canvas, gl) {
241242

242-
var success = tryCreatePlot(scene, camera, canvas, gl);
243+
var success = tryCreatePlot(scene, camera, pixelRatio, canvas, gl);
243244
/*
244245
* createPlot will throw when webgl is not enabled in the client.
245246
* Lets return an instance of the module with all functions noop'd.
@@ -340,7 +341,7 @@ function Scene(options, fullLayout) {
340341
this.spikeOptions = createSpikeOptions(fullLayout[this.id]);
341342
this.container = sceneContainer;
342343
this.staticMode = !!options.staticPlot;
343-
this.pixelRatio = options.plotGlPixelRatio || 2;
344+
this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;
344345

345346
// Coordinate rescaling
346347
this.dataScale = [1, 1, 1];
@@ -351,7 +352,8 @@ function Scene(options, fullLayout) {
351352
this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
352353

353354
var camera = fullLayout.scene.camera;
354-
initializeGLPlot(this, camera);
355+
356+
initializeGLPlot(this, camera, this.pixelRatio);
355357
}
356358

357359
var proto = Scene.prototype;
@@ -377,14 +379,15 @@ proto.recoverContext = function() {
377379
var gl = this.glplot.gl;
378380
var canvas = this.glplot.canvas;
379381
var camera = this.glplot.camera;
382+
var pixelRatio = this.glplot.pixelRatio;
380383
this.glplot.dispose();
381384

382385
function tryRecover() {
383386
if(gl.isContextLost()) {
384387
requestAnimationFrame(tryRecover);
385388
return;
386389
}
387-
if(!initializeGLPlot(scene, camera, canvas, gl)) {
390+
if(!initializeGLPlot(scene, camera, pixelRatio, canvas, gl)) {
388391
Lib.error('Catastrophic and unrecoverable WebGL error. Context lost.');
389392
return;
390393
}
@@ -780,6 +783,8 @@ proto.setCamera = function setCamera(cameraData) {
780783
if(newOrtho !== oldOrtho) {
781784
this.glplot.redraw();
782785

786+
var pixelRatio = this.glplot.pixelRatio;
787+
783788
var RGBA = this.glplot.clearColor;
784789
this.glplot.gl.clearColor(
785790
RGBA[0], RGBA[1], RGBA[2], RGBA[3]
@@ -791,7 +796,7 @@ proto.setCamera = function setCamera(cameraData) {
791796

792797
this.glplot.dispose();
793798

794-
initializeGLPlot(this, cameraData);
799+
initializeGLPlot(this, cameraData, pixelRatio);
795800
this.glplot.camera._ortho = newOrtho;
796801
}
797802
};

src/traces/scatter3d/convert.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ proto.update = function(data) {
343343
this.dataPoints = options.position;
344344

345345
lineOptions = {
346-
gl: gl,
346+
gl: this.scene.glplot.gl,
347347
position: options.position,
348348
color: options.lineColor,
349349
lineWidth: options.lineWidth || 1,
@@ -371,7 +371,7 @@ proto.update = function(data) {
371371
if(data.marker && data.marker.opacity) scatterOpacity *= data.marker.opacity;
372372

373373
scatterOptions = {
374-
gl: gl,
374+
gl: this.scene.glplot.gl,
375375
position: options.position,
376376
color: options.scatterColor,
377377
size: options.scatterSize,
@@ -400,7 +400,7 @@ proto.update = function(data) {
400400
}
401401

402402
textOptions = {
403-
gl: gl,
403+
gl: this.scene.glplot.gl,
404404
position: options.position,
405405
glyph: options.text,
406406
color: options.textColor,
@@ -431,7 +431,7 @@ proto.update = function(data) {
431431
}
432432

433433
errorOptions = {
434-
gl: gl,
434+
gl: this.scene.glplot.gl,
435435
position: options.position,
436436
color: options.errorColor,
437437
error: options.errorBounds,
8 Bytes
79 Bytes
28 Bytes
191 Bytes

test/image/baselines/gl3d_bunny.png

60 Bytes
53 Bytes
-1.58 KB
9.01 KB
60 Bytes

test/image/baselines/gl3d_cube.png

-2.12 KB
19 Bytes
-253 Bytes
22 Bytes
23 Bytes
289 Bytes
-62 Bytes
244 Bytes
-118 Bytes
4 Bytes
6 Bytes
111 Bytes
61 Bytes
-392 Bytes
5 Bytes
-1 Bytes
-40 Bytes
1.02 KB
12 Bytes
149 Bytes
-1 Bytes
-12 Bytes
-10 Bytes
5 Bytes
-355 Bytes
3.88 KB
-1 Bytes

test/image/baselines/gl3d_z-range.png

1 Byte
-2 Bytes

test/image/mocks/gl3d_formatted-text-on-multiple-lines.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"layout": {
1414
"title":"Now texts could be displayed in 3D on multiple lines.",
15-
"width": 1200,
15+
"width": 900,
1616
"height": 900,
1717
"scene":{
1818
"xaxis":{

test/image/mocks/gl3d_mesh3d_surface3d_scatter3d_line3d_error3d_log_reversed_ranges.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
],
9696
"layout": {
9797
"height": 758,
98-
"width": 1310,
98+
"width": 1000,
9999
"title": "X-axis using autorange:'reversed',Y-axis using range:[30,-5] & Z-axis using range:'reversed' & type:log",
100100
"scene": {
101101
"xaxis": {

test/image/mocks/gl3d_mesh3d_surface3d_scatter3d_orthographic.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
],
9696
"layout": {
9797
"height": 758,
98-
"width": 1310,
98+
"width": 1000,
9999
"title": "X-axis using autorange:'reversed',Y-axis using range:[30,-5] & Z-axis using range:'reversed' & type:log",
100100
"scene": {
101101
"xaxis": {

test/image/mocks/gl3d_surface-circular-colorscale.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@
10131013
}
10141014
}
10151015
},
1016-
"width": 1745,
1016+
"width": 878,
10171017
"height": 878
10181018
}
10191019
}

test/jasmine/tests/gl3d_plot_interact_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ describe('Test gl3d plots', function() {
384384
.then(done);
385385
});
386386

387-
it('@gl should display correct hover labels (mesh3d case)', function(done) {
387+
it('@noCI @gl should display correct hover labels (mesh3d case)', function(done) {
388388
var x = [1, 1, 2, 3, 4, 2];
389389
var y = [2, 1, 3, 4, 5, 3];
390390
var z = [3, 7, 4, 5, 3.5, 2];

0 commit comments

Comments
 (0)