@@ -15,7 +15,6 @@ var createPlot = glPlot3d.createScene;
15
15
16
16
var getContext = require ( 'webgl-context' ) ;
17
17
var passiveSupported = require ( 'has-passive-events' ) ;
18
- var isMobile = require ( 'is-mobile' ) ( { tablet : true } ) ;
19
18
20
19
var Registry = require ( '../../registry' ) ;
21
20
var Lib = require ( '../../lib' ) ;
@@ -31,6 +30,39 @@ var createAxesOptions = require('./layout/convert');
31
30
var createSpikeOptions = require ( './layout/spikes' ) ;
32
31
var computeTickMarks = require ( './layout/tick_marks' ) ;
33
32
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
+ }
65
+
34
66
35
67
var STATIC_CANVAS , STATIC_CONTEXT ;
36
68
@@ -96,7 +128,7 @@ proto.tryCreatePlot = function() {
96
128
canvas : scene . canvas ,
97
129
gl : scene . gl ,
98
130
glOptions : {
99
- preserveDrawingBuffer : isMobile ,
131
+ preserveDrawingBuffer : tablet ,
100
132
premultipliedAlpha : true ,
101
133
antialias : true
102
134
} ,
0 commit comments