Skip to content

Return promise after gl rendering #421

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 3 commits into from
Apr 13, 2016
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
5 changes: 4 additions & 1 deletion src/plots/gl2d/scene2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ proto.toImage = function(format) {
if(this.staticPlot) this.container.appendChild(STATIC_CANVAS);

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

// grab context and yank out pixels
Expand Down Expand Up @@ -408,6 +408,9 @@ proto.plot = function(fullData, fullLayout) {

options.merge(fullLayout);
glplot.update(options);

// force redraw so that promise is returned when rendering is completed
this.glplot.draw();
};

proto.draw = function() {
Expand Down
3 changes: 3 additions & 0 deletions src/plots/gl3d/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ proto.plot = function(sceneData, fullLayout, layout) {
containerStyle.width = (size.w * (domain.x[1] - domain.x[0])) + 'px';
containerStyle.height = (size.h * (domain.y[1] - domain.y[0])) + 'px';
}

// force redraw so that promise is returned when rendering is completed
this.glplot.redraw();
};

proto.destroy = function() {
Expand Down
15 changes: 4 additions & 11 deletions test/jasmine/tests/gl_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ var customMatchers = require('../assets/custom_matchers');
*
*/

var PLOT_DELAY = 200;
var MOUSE_DELAY = 20;
var MODEBAR_DELAY = 500;


Expand Down Expand Up @@ -54,10 +52,9 @@ describe('Test gl plot interactions', function() {
destroyGraphDiv();
});

// ...
function delay(done) {
setTimeout(function() {
done();
}, PLOT_DELAY);
setTimeout(done, 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a 0 second timeout for the gl3d hover labels to test to pass reliably (at least on my machine).

More info in: #122 (comment)

}

describe('gl3d plots', function() {
Expand Down Expand Up @@ -99,9 +96,7 @@ describe('Test gl plot interactions', function() {

mouseEventScatter3d('mouseover');

setTimeout(function() {
done();
}, MOUSE_DELAY);
delay(done);
});

it('should have', function() {
Expand Down Expand Up @@ -139,9 +134,7 @@ describe('Test gl plot interactions', function() {
// with button 1 pressed
mouseEventScatter3d('mouseover', {buttons: 1});

setTimeout(function() {
done();
}, MOUSE_DELAY);
delay(done);
});

it('should have', function() {
Expand Down