Skip to content

Commit 225c97e

Browse files
authored
Merge pull request #4548 from plotly/bump-is-mobile-ipad-ios13
Bump is-mobile to handle iOS 13 + iPad case
2 parents 52a5d83 + 1164bab commit 225c97e

File tree

3 files changed

+11
-42
lines changed

3 files changed

+11
-42
lines changed

package-lock.json

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

package.json

+2-2
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.2",
85+
"gl-plot3d": "^2.4.3",
8686
"gl-pointcloud2d": "^1.0.2",
8787
"gl-scatter3d": "^1.2.2",
8888
"gl-select-box": "^1.0.3",
@@ -93,7 +93,7 @@
9393
"glslify": "^7.0.0",
9494
"has-hover": "^1.0.1",
9595
"has-passive-events": "^1.0.0",
96-
"is-mobile": "^2.1.0",
96+
"is-mobile": "^2.2.0",
9797
"mapbox-gl": "1.3.2",
9898
"matrix-camera-controller": "^2.1.3",
9999
"mouse-change": "^1.4.0",

src/plots/gl3d/scene.js

+2-33
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,7 @@ var createAxesOptions = require('./layout/convert');
3030
var createSpikeOptions = require('./layout/spikes');
3131
var computeTickMarks = require('./layout/tick_marks');
3232

33-
var isMobile = require('is-mobile');
34-
var tablet = isTablet();
35-
36-
function isTablet() {
37-
if(!navigator) return false;
38-
39-
var ua;
40-
// same interface as applied by is-mobile module
41-
if(!ua && typeof navigator !== 'undefined') ua = navigator.userAgent;
42-
if(ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
43-
ua = ua.headers['user-agent'];
44-
}
45-
if(typeof ua !== 'string') return false;
46-
47-
var result = isMobile({
48-
ua: ua,
49-
tablet: true
50-
});
51-
52-
// handle iPad pro or iPad with iOs 13 using Safari
53-
// see https://github.com/plotly/plotly.js/issues/4502
54-
if(
55-
result === false &&
56-
ua.indexOf('Macintosh') !== -1 &&
57-
ua.indexOf('Safari') !== -1 &&
58-
navigator.maxTouchPoints > 1
59-
) {
60-
result = true;
61-
}
62-
63-
return result;
64-
}
33+
var isMobile = require('is-mobile')({ tablet: true, featureDetect: true });
6534

6635

6736
var STATIC_CANVAS, STATIC_CONTEXT;
@@ -128,7 +97,7 @@ proto.tryCreatePlot = function() {
12897
canvas: scene.canvas,
12998
gl: scene.gl,
13099
glOptions: {
131-
preserveDrawingBuffer: tablet,
100+
preserveDrawingBuffer: isMobile,
132101
premultipliedAlpha: true,
133102
antialias: true
134103
},

0 commit comments

Comments
 (0)