Skip to content

Commit 63c51d1

Browse files
committed
bump gl-plot3d and fix issue 4502 - handle Safari with iPad (Pro) + iOS 13
1 parent e1e12b9 commit 63c51d1

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

package-lock.json

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"gl-mat4": "^1.2.0",
8383
"gl-mesh3d": "^2.3.0",
8484
"gl-plot2d": "^1.4.3",
85-
"gl-plot3d": "^2.4.1",
85+
"gl-plot3d": "^2.4.2",
8686
"gl-pointcloud2d": "^1.0.2",
8787
"gl-scatter3d": "^1.2.2",
8888
"gl-select-box": "^1.0.3",

src/plots/gl3d/scene.js

+27-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var createPlot = glPlot3d.createScene;
1515

1616
var getContext = require('webgl-context');
1717
var passiveSupported = require('has-passive-events');
18-
var isMobile = require('is-mobile')({ tablet: true });
1918

2019
var Registry = require('../../registry');
2120
var Lib = require('../../lib');
@@ -31,6 +30,32 @@ var createAxesOptions = require('./layout/convert');
3130
var createSpikeOptions = require('./layout/spikes');
3231
var computeTickMarks = require('./layout/tick_marks');
3332

33+
var isMobile = require('is-mobile');
34+
var tablet = isTablet();
35+
36+
function isTablet() {
37+
var navigator = window.navigator;
38+
var userAgent = navigator.userAgent;
39+
40+
var result = isMobile({
41+
ua: userAgent,
42+
tablet: true
43+
});
44+
45+
// handle iPad pro or iPad with iOs 13 using Safari
46+
// see https://github.com/plotly/plotly.js/issues/4502
47+
if(
48+
result === false &&
49+
userAgent.indexOf('Macintosh') !== -1 &&
50+
userAgent.indexOf('Safari') !== -1 &&
51+
navigator.maxTouchPoints > 1
52+
) {
53+
result = true;
54+
}
55+
56+
return result;
57+
}
58+
3459

3560
var STATIC_CANVAS, STATIC_CONTEXT;
3661

@@ -96,7 +121,7 @@ proto.tryCreatePlot = function() {
96121
canvas: scene.canvas,
97122
gl: scene.gl,
98123
glOptions: {
99-
preserveDrawingBuffer: isMobile,
124+
preserveDrawingBuffer: tablet,
100125
premultipliedAlpha: true,
101126
antialias: true
102127
},

0 commit comments

Comments
 (0)