diff --git a/src/plots/gl2d/scene2d.js b/src/plots/gl2d/scene2d.js index fc0af4a335f..fb16dffb638 100644 --- a/src/plots/gl2d/scene2d.js +++ b/src/plots/gl2d/scene2d.js @@ -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 @@ -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() { diff --git a/src/plots/gl3d/scene.js b/src/plots/gl3d/scene.js index a7800eb7f9b..feaccfbdc56 100644 --- a/src/plots/gl3d/scene.js +++ b/src/plots/gl3d/scene.js @@ -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() { diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index ab5274be3f6..add05802397 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -16,8 +16,6 @@ var customMatchers = require('../assets/custom_matchers'); * */ -var PLOT_DELAY = 200; -var MOUSE_DELAY = 20; var MODEBAR_DELAY = 500; @@ -54,10 +52,9 @@ describe('Test gl plot interactions', function() { destroyGraphDiv(); }); + // ... function delay(done) { - setTimeout(function() { - done(); - }, PLOT_DELAY); + setTimeout(done, 0); } describe('gl3d plots', function() { @@ -99,9 +96,7 @@ describe('Test gl plot interactions', function() { mouseEventScatter3d('mouseover'); - setTimeout(function() { - done(); - }, MOUSE_DELAY); + delay(done); }); it('should have', function() { @@ -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() {