Skip to content

Commit 4c26380

Browse files
committed
Fix regl check
1 parent b4b60e4 commit 4c26380

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/plot_api/plot_api.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,20 @@ function _doPlot(gd, data, layout, config) {
221221
});
222222
}
223223

224+
var plotGlPixelRatio = gd._context.plotGlPixelRatio
224225
if(fullLayout._glcanvas) {
225226
fullLayout._glcanvas
226-
.attr('width', fullLayout.width * gd._context.plotGlPixelRatio)
227-
.attr('height', fullLayout.height * gd._context.plotGlPixelRatio)
227+
.attr('width', fullLayout.width * plotGlPixelRatio)
228+
.attr('height', fullLayout.height * plotGlPixelRatio)
228229
.style('width', fullLayout.width + 'px')
229230
.style('height', fullLayout.height + 'px');
230231

231232
var regl = fullLayout._glcanvas.data()[0].regl;
232233
if(regl) {
233234
// Unfortunately, this can happen when relayouting to large
234235
// width/height on some browsers.
235-
if(Math.floor(fullLayout.width) !== regl._gl.drawingBufferWidth ||
236-
Math.floor(fullLayout.height) !== regl._gl.drawingBufferHeight
236+
if(Math.floor(fullLayout.width * plotGlPixelRatio) !== regl._gl.drawingBufferWidth ||
237+
Math.floor(fullLayout.height * plotGlPixelRatio) !== regl._gl.drawingBufferHeight
237238
) {
238239
var msg = 'WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug.';
239240
if(drawFrameworkCalls) {

0 commit comments

Comments
 (0)