-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix 3-D config for webgl buffer on iPad Pro & iPad 7th + iOs v13 + Safari #4546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ var createPlot = glPlot3d.createScene; | |
|
||
var getContext = require('webgl-context'); | ||
var passiveSupported = require('has-passive-events'); | ||
var isMobile = require('is-mobile')({ tablet: true }); | ||
|
||
var Registry = require('../../registry'); | ||
var Lib = require('../../lib'); | ||
|
@@ -31,6 +30,39 @@ 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How did you find this solution? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
) { | ||
result = true; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
var STATIC_CANVAS, STATIC_CONTEXT; | ||
|
||
|
@@ -96,7 +128,7 @@ proto.tryCreatePlot = function() { | |
canvas: scene.canvas, | ||
gl: scene.gl, | ||
glOptions: { | ||
preserveDrawingBuffer: isMobile, | ||
preserveDrawingBuffer: tablet, | ||
premultipliedAlpha: true, | ||
antialias: true | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gl-vis/gl-plot3d#27