@@ -243,21 +243,22 @@ exports.plot = function(gd, data, layout, config) {
243243 . attr ( 'width' , fullLayout . width )
244244 . attr ( 'height' , fullLayout . height ) ;
245245
246-
247246 var regl = fullLayout . _glcanvas . data ( ) [ 0 ] . regl ;
248247 if ( regl ) {
249- if (
250- fullLayout . width !== regl . _gl . drawingBufferWidth ||
248+ // Unfortunately, this can happen when relayouting to large
249+ // width/height on some browsers.
250+ if ( fullLayout . width !== regl . _gl . drawingBufferWidth ||
251251 fullLayout . height !== regl . _gl . drawingBufferHeight
252252 ) {
253- // Unfortunately, this can happen when relayouting to large
254- // width/height on some browsers.
255- Lib . log ( [
256- 'WebGL context buffer and canvas dimensions do not match,' ,
257- 'due to browser/WebGL bug.' ,
258- 'Clearing graph and plotting again.'
259- ] . join ( ' ' ) ) ;
260- exports . newPlot ( gd , gd . data , gd . layout ) ;
253+ var msg = 'WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug.' ;
254+ if ( fullLayout . _redrawFromWrongGlDimensions ) {
255+ Lib . error ( msg ) ;
256+ } else {
257+ Lib . log ( msg + ' Clearing graph and plotting again.' ) ;
258+ fullLayout . _redrawFromWrongGlDimensions = 1 ;
259+ Plots . cleanPlot ( [ ] , { } , gd . _fullData , fullLayout , gd . calcdata ) ;
260+ exports . plot ( gd , gd . data , gd . layout ) ;
261+ }
261262 }
262263 }
263264 }
0 commit comments