continuing to try to make thing work.

This commit is contained in:
Danny Yoo 2011-07-18 10:08:38 -04:00
parent b034624402
commit 1ba498b4e3

View File

@ -38,7 +38,7 @@ var bigBang = function(MACHINE, initW, handlers) {
// If we haven't seen an onDraw function, use the default one. // If we haven't seen an onDraw function, use the default one.
if (! isOnDrawSeen) { if (! isOnDrawSeen) {
configs.push(new DefaultOnDraw().toDrawHandler(MACHINE)); configs.push(new DefaultOnDraw(toplevelNode.get(0)).toRawHandler(MACHINE));
} }
@ -180,7 +180,7 @@ OnTick.prototype.toRawHandler = function(MACHINE) {
// OnDraw // // OnDraw
var OnDraw = function(handler) { var OnDraw = function(handler) {
WorldConfigOption.call(this, 'on-tick'); WorldConfigOption.call(this, 'on-tick');
@ -203,16 +203,19 @@ var isOnDraw = plt.baselib.makeClassPredicate(OnDraw);
var DefaultOnDraw = function() { var DefaultOnDraw = function(toplevelNode) {
WorldConfigOption.call(this, 'on-tick'); WorldConfigOption.call(this, 'on-tick');
this.toplevelNode = toplevelNode;
}; };
DefaultOnDraw.prototype = plt.baselib.heir(WorldConfigOption.prototype); DefaultOnDraw.prototype = plt.baselib.heir(WorldConfigOption.prototype);
DefaultOnDraw.prototype.toRawHandler = function(MACHINE) { DefaultOnDraw.prototype.toRawHandler = function(MACHINE) {
var that = this;
var worldFunction = function(world, k) { var worldFunction = function(world, k) {
console.log('about to call the on-draw'); console.log(rawJsworld.node_to_tree(plt.baselib.format.toDomNode(world)));
k(plt.baselib.format.toDomNode(world)); k([that.toplevelNode,
rawJsworld.node_to_tree(plt.baselib.format.toDomNode(world))]);
}; };
var cssFunction = function(w, k) { k([]); } var cssFunction = function(w, k) { k([]); }
return rawJsworld.on_draw(worldFunction, cssFunction); return rawJsworld.on_draw(worldFunction, cssFunction);