diff --git a/package-lock.json b/package-lock.json index ef5169bcf18..e526e0f1af1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4975,9 +4975,9 @@ } }, "gl-plot3d": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/gl-plot3d/-/gl-plot3d-2.4.2.tgz", - "integrity": "sha512-nBLTqKCLOlPnf/8kWJdZxZTdcK7U0KqHO13T08dakfv2a1xiiy4qgqjjI42UXZOkthrqyt4VszBQ/D4qBgTHBw==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/gl-plot3d/-/gl-plot3d-2.4.3.tgz", + "integrity": "sha512-CNLB48l1L0EFmf27CvsQzSIqMVDdXeuj/WZeKRHutmx+IeeJF1ueIhYZYzhhTFd5x+/vrVc3fzis33PthTlItQ==", "requires": { "3d-view": "^2.0.0", "a-big-triangle": "^1.0.3", @@ -4989,7 +4989,7 @@ "gl-spikes3d": "^1.0.9", "glslify": "^7.0.0", "has-passive-events": "^1.0.0", - "is-mobile": "^2.1.0", + "is-mobile": "^2.2.0", "mouse-change": "^1.4.0", "mouse-event-offset": "^3.0.2", "mouse-wheel": "^1.2.0", @@ -6323,9 +6323,9 @@ "dev": true }, "is-mobile": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-mobile/-/is-mobile-2.1.0.tgz", - "integrity": "sha512-M5OhlZwh+aTlmRUvDg0Wq3uWVNa+w4DyZ2SjbrS+BhSLu9Po+JXHendC305ZEu+Hh7lywb19Zu4kYXu3L1Oo8A==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-mobile/-/is-mobile-2.2.0.tgz", + "integrity": "sha512-K0DmUqaZqYl6M8ej536uJYAQaBkx+qWph7xl1KRBr31UiGUT0MoFWUoqnIxzXnIeolnK8bkxtKXkZNL6HfSHhQ==" }, "is-number": { "version": "3.0.0", diff --git a/package.json b/package.json index 2374dba1530..33e74b782f9 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "gl-mat4": "^1.2.0", "gl-mesh3d": "^2.3.0", "gl-plot2d": "^1.4.3", - "gl-plot3d": "^2.4.2", + "gl-plot3d": "^2.4.3", "gl-pointcloud2d": "^1.0.2", "gl-scatter3d": "^1.2.2", "gl-select-box": "^1.0.3", @@ -93,7 +93,7 @@ "glslify": "^7.0.0", "has-hover": "^1.0.1", "has-passive-events": "^1.0.0", - "is-mobile": "^2.1.0", + "is-mobile": "^2.2.0", "mapbox-gl": "1.3.2", "matrix-camera-controller": "^2.1.3", "mouse-change": "^1.4.0", diff --git a/src/plots/gl3d/scene.js b/src/plots/gl3d/scene.js index 1b05755a0cb..e26157ace03 100644 --- a/src/plots/gl3d/scene.js +++ b/src/plots/gl3d/scene.js @@ -30,38 +30,7 @@ var createAxesOptions = require('./layout/convert'); var createSpikeOptions = require('./layout/spikes'); var computeTickMarks = require('./layout/tick_marks'); -var isMobile = require('is-mobile'); -var tablet = isTablet(); - -function isTablet() { - if(!navigator) return false; - - var ua; - // same interface as applied by is-mobile module - if(!ua && typeof navigator !== 'undefined') ua = navigator.userAgent; - if(ua && ua.headers && typeof ua.headers['user-agent'] === 'string') { - ua = ua.headers['user-agent']; - } - if(typeof ua !== 'string') return false; - - var result = isMobile({ - ua: ua, - tablet: true - }); - - // handle iPad pro or iPad with iOs 13 using Safari - // see https://github.com/plotly/plotly.js/issues/4502 - if( - result === false && - ua.indexOf('Macintosh') !== -1 && - ua.indexOf('Safari') !== -1 && - navigator.maxTouchPoints > 1 - ) { - result = true; - } - - return result; -} +var isMobile = require('is-mobile')({ tablet: true, featureDetect: true }); var STATIC_CANVAS, STATIC_CONTEXT; @@ -128,7 +97,7 @@ proto.tryCreatePlot = function() { canvas: scene.canvas, gl: scene.gl, glOptions: { - preserveDrawingBuffer: tablet, + preserveDrawingBuffer: isMobile, premultipliedAlpha: true, antialias: true },