Skip to content

Commit 0838c31

Browse files
committed
Scope regl creation by trace
1 parent f711cf1 commit 0838c31

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/plot_api/plot_api.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ var enforceAxisConstraints = axisConstraints.enforce;
4242
var cleanAxisConstraints = axisConstraints.clean;
4343
var axisIds = require('../plots/cartesian/axis_ids');
4444

45-
var createRegl = require('regl');
46-
4745

4846
/**
4947
* Main plot-creation function
@@ -213,17 +211,6 @@ Plotly.plot = function(gd, data, layout, config) {
213211
}]);
214212

215213
fullLayout._glcanvas.enter().append('canvas')
216-
.each(function(d) {
217-
d.regl = createRegl({
218-
canvas: this,
219-
attributes: {
220-
antialias: !d.pick,
221-
preserveDrawingBuffer: true
222-
},
223-
extensions: ['ANGLE_instanced_arrays', 'OES_element_index_uint'],
224-
pixelRatio: gd._context.plotGlPixelRatio || global.devicePixelRatio
225-
});
226-
})
227214
.attr('class', function(d) {
228215
return 'gl-canvas gl-canvas-' + d.key.replace('Layer', '');
229216
})

src/traces/parcoords/plot.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'use strict';
1010

1111
var parcoords = require('./parcoords');
12+
var createRegl = require('regl');
1213

1314
module.exports = function plot(gd, cdparcoords) {
1415

@@ -17,6 +18,19 @@ module.exports = function plot(gd, cdparcoords) {
1718
var root = fullLayout._paperdiv;
1819
var container = fullLayout._glcontainer;
1920

21+
// make sure proper regl instances are created
22+
fullLayout._glcanvas.each(function(d) {
23+
if(d.regl) return;
24+
d.regl = createRegl({
25+
canvas: this,
26+
attributes: {
27+
antialias: !d.pick,
28+
preserveDrawingBuffer: true
29+
},
30+
pixelRatio: gd._context.plotGlPixelRatio || global.devicePixelRatio
31+
});
32+
});
33+
2034
var gdDimensions = {};
2135
var gdDimensionsOriginalOrder = {};
2236

0 commit comments

Comments
 (0)