File tree Expand file tree Collapse file tree 1 file changed +26
-8
lines changed Expand file tree Collapse file tree 1 file changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,9 @@ function Scene(options, fullLayout) {
91
91
92
92
var proto = Scene . prototype ;
93
93
94
- proto . tryCreatePlot = function ( ) {
94
+ proto . prepareOptions = function ( ) {
95
95
var scene = this ;
96
+
96
97
var opts = {
97
98
canvas : scene . canvas ,
98
99
gl : scene . gl ,
@@ -132,20 +133,37 @@ proto.tryCreatePlot = function() {
132
133
opts . canvas = STATIC_CANVAS ;
133
134
}
134
135
135
- var failed = 0 ;
136
+ return opts ;
137
+ } ;
138
+
139
+ proto . tryCreatePlot = function ( ) {
140
+ var scene = this ;
141
+
142
+ var opts = scene . prepareOptions ( ) ;
143
+
144
+ var success = true ;
136
145
137
146
try {
138
147
scene . glplot = createPlot ( opts ) ;
139
148
} catch ( e ) {
140
- failed ++ ;
141
- try { // try second time to fix issue with Chrome 77 https://github.com/plotly/plotly.js/issues/4233
142
- scene . glplot = createPlot ( opts ) ;
143
- } catch ( e ) {
144
- failed ++ ;
149
+ if ( scene . staticMode ) {
150
+ success = false ;
151
+ } else { // try second time
152
+ // make fresh object for options
153
+ opts = scene . prepareOptions ( ) ;
154
+
155
+ try {
156
+ // invert preserveDrawingBuffer setup which could be resulted from is-mobile not detecting the right device
157
+ opts . glOptions . preserveDrawingBuffer = ! opts . glOptions . preserveDrawingBuffer ;
158
+
159
+ scene . glplot = createPlot ( opts ) ;
160
+ } catch ( e ) {
161
+ success = false ;
162
+ }
145
163
}
146
164
}
147
165
148
- return failed < 2 ;
166
+ return success ;
149
167
} ;
150
168
151
169
proto . initializeGLCamera = function ( ) {
You can’t perform that action at this time.
0 commit comments