File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ proto.prepareOptions = function() {
136136 return opts ;
137137} ;
138138
139+ var firstInit = true ;
140+
139141proto . tryCreatePlot = function ( ) {
140142 var scene = this ;
141143
@@ -146,7 +148,7 @@ proto.tryCreatePlot = function() {
146148 try {
147149 scene . glplot = createPlot ( opts ) ;
148150 } catch ( e ) {
149- if ( scene . staticMode ) {
151+ if ( scene . staticMode || ! firstInit ) {
150152 success = false ;
151153 } else { // try second time
152154 try {
@@ -158,15 +160,22 @@ proto.tryCreatePlot = function() {
158160 'The device may not be supported by is-mobile module!' ,
159161 'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.'
160162 ] . join ( ' ' ) ) ;
163+
164+ // invert is-mobile
161165 isMobile = opts . glOptions . preserveDrawingBuffer = ! opts . glOptions . preserveDrawingBuffer ;
162166
163167 scene . glplot = createPlot ( opts ) ;
164168 } catch ( e ) {
169+ // revert changes to is-mobile
170+ isMobile = opts . glOptions . preserveDrawingBuffer = ! opts . glOptions . preserveDrawingBuffer ;
171+
165172 success = false ;
166173 }
167174 }
168175 }
169176
177+ firstInit = false ;
178+
170179 return success ;
171180} ;
172181
You can’t perform that action at this time.
0 commit comments