ripping out an optimization that's hurting the code readability
This commit is contained in:
parent
1ba498b4e3
commit
815a632be1
|
@ -158,7 +158,6 @@ OnTick.prototype = plt.baselib.heir(WorldConfigOption.prototype);
|
||||||
|
|
||||||
OnTick.prototype.toRawHandler = function(MACHINE) {
|
OnTick.prototype.toRawHandler = function(MACHINE) {
|
||||||
var worldFunction = function(world, k) {
|
var worldFunction = function(world, k) {
|
||||||
console.log('about to call the on-tick');
|
|
||||||
k(world + 1);
|
k(world + 1);
|
||||||
// plt.baselib.functions.internalCallDuringPause(
|
// plt.baselib.functions.internalCallDuringPause(
|
||||||
// MACHINE,
|
// MACHINE,
|
||||||
|
@ -183,7 +182,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-draw');
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ var isOnDraw = plt.baselib.makeClassPredicate(OnDraw);
|
||||||
|
|
||||||
|
|
||||||
var DefaultOnDraw = function(toplevelNode) {
|
var DefaultOnDraw = function(toplevelNode) {
|
||||||
WorldConfigOption.call(this, 'on-tick');
|
WorldConfigOption.call(this, 'on-draw');
|
||||||
this.toplevelNode = toplevelNode;
|
this.toplevelNode = toplevelNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -668,39 +668,35 @@ var rawJsworld = {};
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// We try to avoid updating the dom if the value
|
|
||||||
// hasn't changed.
|
|
||||||
redraw_func(oldWorld,
|
|
||||||
function(oldRedraw) {
|
|
||||||
redraw_func(world,
|
|
||||||
function(newRedraw) {
|
|
||||||
redraw_css_func(oldWorld,
|
|
||||||
function(oldRedrawCss) {
|
|
||||||
redraw_css_func(world,
|
|
||||||
function(newRedrawCss) {
|
|
||||||
var t = sexp2tree(newRedraw);
|
|
||||||
var ns = nodes(t);
|
|
||||||
|
|
||||||
// Try to save the current selection and preserve it across
|
redraw_func(
|
||||||
// dom updates.
|
world,
|
||||||
|
function(newRedraw) {
|
||||||
|
|
||||||
if(oldRedraw !== newRedraw) {
|
redraw_css_func(
|
||||||
// Kludge: update the CSS styles first.
|
world,
|
||||||
// This is a workaround an issue with excanvas: any style change
|
function(newRedrawCss) {
|
||||||
// clears the content of the canvas, so we do this first before
|
var t = sexp2tree(newRedraw);
|
||||||
// attaching the dom element.
|
var ns = nodes(t);
|
||||||
update_css(ns, sexp2css(newRedrawCss));
|
|
||||||
update_dom(toplevelNode, ns, relations(t));
|
// Try to save the current selection and preserve it across
|
||||||
} else {
|
// dom updates.
|
||||||
if (oldRedrawCss !== newRedrawCss) {
|
|
||||||
update_css(ns, sexp2css(newRedrawCss));
|
// Kludge: update the CSS styles first.
|
||||||
}
|
// This is a workaround an issue with excanvas: any style change
|
||||||
}
|
// clears the content of the canvas, so we do this first before
|
||||||
k2();
|
// attaching the dom element.
|
||||||
})
|
update_css(ns, sexp2css(newRedrawCss));
|
||||||
})
|
update_dom(toplevelNode, ns, relations(t));
|
||||||
|
|
||||||
|
k2();
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, k);
|
}, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user