Skip to content

Commit 6630336

Browse files
authoredJul 12, 2021
Merge pull request #5500 from plotly/scattergl_glpixelratio
Improve rendering of scattergl, splom and parcoords by implementing plotGlPixelRatio for those traces
2 parents 5c50174 + 89e2437 commit 6630336

File tree

131 files changed

+213
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+213
-112
lines changed
 

‎draftlogs/5500_fix.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Improve rendering of scattergl, splom and parcoords by implementing plotGlPixelRatio for those traces [[#5500](https://github.com/plotly/plotly.js/pull/5500)]

‎src/plot_api/plot_api.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,20 @@ function _doPlot(gd, data, layout, config) {
222222
});
223223
}
224224

225+
var plotGlPixelRatio = gd._context.plotGlPixelRatio;
225226
if(fullLayout._glcanvas) {
226227
fullLayout._glcanvas
227-
.attr('width', fullLayout.width)
228-
.attr('height', fullLayout.height);
228+
.attr('width', fullLayout.width * plotGlPixelRatio)
229+
.attr('height', fullLayout.height * plotGlPixelRatio)
230+
.style('width', fullLayout.width + 'px')
231+
.style('height', fullLayout.height + 'px');
229232

230233
var regl = fullLayout._glcanvas.data()[0].regl;
231234
if(regl) {
232235
// Unfortunately, this can happen when relayouting to large
233236
// width/height on some browsers.
234-
if(Math.floor(fullLayout.width) !== regl._gl.drawingBufferWidth ||
235-
Math.floor(fullLayout.height) !== regl._gl.drawingBufferHeight
237+
if(Math.floor(fullLayout.width * plotGlPixelRatio) !== regl._gl.drawingBufferWidth ||
238+
Math.floor(fullLayout.height * plotGlPixelRatio) !== regl._gl.drawingBufferHeight
236239
) {
237240
var msg = 'WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug.';
238241
if(drawFrameworkCalls) {

0 commit comments

Comments
 (0)
Please sign in to comment.