sorry,
--
I would never die for my beliefs because I might be wrong.
Bertrand Russell
Thanks for your advice.
I've tested it and it doesn't work.
I also checked for MooCanvas, to see if they implemented a workaround,
but still no luck:
/*
Property: clearRect
Clears the pixels in the specified rectangle.
If height or width are zero has no effect.
If no arguments, clears all of the canvas
Currently, clearRect clears all of the canvas.
*/
However, there is a hack you can do that can make it work.
If you know a priori the background color of the canvas object, then
you could replace the clearRectangle Canvas method I defined in the
visualization in order to plot a fillRect instead of a clearRect,
having as fill color the background color of the canvas.
The code would be something like this:
/*
Method: clearReactangle
Same as <clear> but only clears a section of the canvas.
Parameters:
top - An integer specifying the top of the rectangle.
right - An integer specifying the right of the rectangle.
bottom - An integer specifying the bottom of the rectangle.
left - An integer specifying the left of the rectangle.
*/
clearRectangle: function (top, right, bottom, left) {
var ctx = this.ctx;
var f0 = ctx.fillStyle;
ctx.fillStyle = '#333'; //hardcoded canvas background color.
ctx.fillRect(left, top, right - left, bottom - top);
ctx.fillStyle = f0;
//this.ctx.clearRect(left, top-2, right - left +2, Math.abs(bottom - top)+5);
},
I've tested it and it works quite well.
There are still a couple of things to do in order to make it work (a
coulple of silly bugs I've found for IE that I've already fixed, and
also you have to strip off the canvas detection in the constructor for
the Canvas object).
I'm attaching a file with these changes (I think that that works in
the google groups?). Please let me know if you find more problems.
Hope it helped!