Skip to content

Commit 60e6278

Browse files
authored
Merge pull request #2238 from plotly/gl2d-multisubplot-fix
Gl2d multisubplot fix for
2 parents 8cc5f55 + cd38db2 commit 60e6278

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"gl-line3d": "^1.1.0",
7575
"gl-mat4": "^1.1.2",
7676
"gl-mesh3d": "^1.3.0",
77-
"gl-plot2d": "^1.2.0",
77+
"gl-plot2d": "^1.3.0",
7878
"gl-plot3d": "^1.5.4",
7979
"gl-pointcloud2d": "^1.0.0",
8080
"gl-scatter2d": "^1.3.2",

src/plots/gl2d/convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function Axes2DOptions(scene) {
8686
[0, 0, 0, 1]
8787
];
8888

89-
this.borderColor = [0, 0, 0, 0];
89+
this.borderColor = false;
9090
this.backgroundColor = [0, 0, 0, 0];
9191

9292
this.static = this.scene.staticPlot;

src/plots/gl2d/scene2d.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ proto.makeFramework = function() {
118118

119119
var gl = getContext({
120120
canvas: liveCanvas,
121+
preserveDrawingBuffer: true,
121122
premultipliedAlpha: true
122123
});
123124

@@ -181,20 +182,24 @@ proto.toImage = function(format) {
181182
if(!format) format = 'png';
182183

183184
this.stopped = true;
185+
184186
if(this.staticPlot) this.container.appendChild(STATIC_CANVAS);
185187

186188
// update canvas size
187189
this.updateSize(this.canvas);
188190

189-
// force redraw
190-
this.glplot.setDirty();
191-
this.glplot.draw();
192191

193192
// grab context and yank out pixels
194193
var gl = this.glplot.gl,
195194
w = gl.drawingBufferWidth,
196195
h = gl.drawingBufferHeight;
197196

197+
// force redraw
198+
gl.clearColor(1, 1, 1, 0);
199+
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
200+
this.glplot.setDirty();
201+
this.glplot.draw();
202+
198203
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
199204

200205
var pixels = new Uint8Array(w * h * 4);

src/traces/scattergl/select.js

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ module.exports = function selectPoints(searchInfo, polygon) {
2323
y;
2424

2525
var glTrace = cd[0]._glTrace;
26+
27+
if(!glTrace) return;
28+
2629
var scene = glTrace.scene;
2730

2831
var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace));

0 commit comments

Comments
 (0)