fixed really subtle process.nextTick bug

This commit is contained in:
Peter Cottle 2013-01-05 16:55:24 -08:00
parent e74266f00e
commit d5bddcc6b4
4 changed files with 24 additions and 15 deletions

View file

@ -20,11 +20,12 @@ var Visualization = Backbone.View.extend({
// we want to add our canvas somewhere
var container = options.containerElement || $('#canvasHolder')[0];
new Raphael(container, 200, 200, function() {
// for some reason raphael calls this function with a predefined
// context...
// so switch it
_this.paperInitialize(this, options);
// raphael calls with paper as this for some inane reason...
var paper = this;
// use process.nextTick to go from sync to async
process.nextTick(function() {
_this.paperInitialize(paper, options);
});
});
},