continuing to work on the image example

This commit is contained in:
Danny Yoo 2011-07-13 15:13:02 -04:00
parent df685d037c
commit 1deed94e04
2 changed files with 8 additions and 4 deletions

View File

@ -157,16 +157,18 @@ BaseImage.prototype.toDomNode = function(cache) {
var height = that.getHeight();
var canvas = makeCanvas(width, height);
// KLUDGE: on IE, the canvas rendering functions depend on a
// context where the canvas is attached to the DOM tree.
// We initialize an afterAttach hook; the client's responsible
// for calling this after the dom node is attached to the
// document.
canvas.afterAttach = function() {
var ctx = canvas.getContext("2d");
that.render(ctx, 0, 0);
};
$(canvas).bind('afterAttach',
function(event) {
var ctx = canvas.getContext("2d");
that.render(ctx, 0, 0);
});
return canvas;
};

View File

@ -16,6 +16,7 @@
StandardOutputPort.prototype = baselib.heir(OutputPort.prototype);
StandardOutputPort.prototype.writeDomNode = function(MACHINE, domNode) {
MACHINE.params['currentDisplayer'](MACHINE, domNode);
jQuery(domNode).trigger({type : 'afterAttach'});
};
var StandardErrorPort = function() {
@ -24,6 +25,7 @@
StandardErrorPort.prototype = baselib.heir(OutputPort.prototype);
StandardErrorPort.prototype.writeDomNode = function(MACHINE, domNode) {
MACHINE.params['currentErrorDisplayer'](MACHINE, domNode);
jQuery(domNode).trigger({type : 'afterAttach'});
};