Skip to content

Gl2d multisubplot fix for #2238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"gl-line3d": "^1.1.0",
"gl-mat4": "^1.1.2",
"gl-mesh3d": "^1.3.0",
"gl-plot2d": "^1.2.0",
"gl-plot2d": "^1.3.0",
"gl-plot3d": "^1.5.4",
"gl-pointcloud2d": "^1.0.0",
"gl-scatter2d": "^1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion src/plots/gl2d/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function Axes2DOptions(scene) {
[0, 0, 0, 1]
];

this.borderColor = [0, 0, 0, 0];
this.borderColor = false;
this.backgroundColor = [0, 0, 0, 0];

this.static = this.scene.staticPlot;
Expand Down
11 changes: 8 additions & 3 deletions src/plots/gl2d/scene2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ proto.makeFramework = function() {

var gl = getContext({
canvas: liveCanvas,
preserveDrawingBuffer: true,
premultipliedAlpha: true
});

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

this.stopped = true;

if(this.staticPlot) this.container.appendChild(STATIC_CANVAS);

// update canvas size
this.updateSize(this.canvas);

// force redraw
this.glplot.setDirty();
this.glplot.draw();

// grab context and yank out pixels
var gl = this.glplot.gl,
w = gl.drawingBufferWidth,
h = gl.drawingBufferHeight;

// force redraw
gl.clearColor(1, 1, 1, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
this.glplot.setDirty();
this.glplot.draw();

gl.bindFramebuffer(gl.FRAMEBUFFER, null);

var pixels = new Uint8Array(w * h * 4);
Expand Down
3 changes: 3 additions & 0 deletions src/traces/scattergl/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = function selectPoints(searchInfo, polygon) {
y;

var glTrace = cd[0]._glTrace;

if(!glTrace) return;

var scene = glTrace.scene;

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