@@ -243,21 +243,22 @@ exports.plot = function(gd, data, layout, config) {
243
243
. attr ( 'width' , fullLayout . width )
244
244
. attr ( 'height' , fullLayout . height ) ;
245
245
246
-
247
246
var regl = fullLayout . _glcanvas . data ( ) [ 0 ] . regl ;
248
247
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 ||
251
251
fullLayout . height !== regl . _gl . drawingBufferHeight
252
252
) {
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
+ }
261
262
}
262
263
}
263
264
}
0 commit comments