Bug 3: the drawn image never scales with resizing of the canvas.
To help diagnose this bug, I wanted to make sure the onResize()
function in excanvas.js was getting called as expected, so I added an
alert("resizing"). You can also press ctrl+A on the page to see that
the canvas inner div is in fact the correct size, but the drawn image
has not changed.
Note that the canvas was sized even before the drawImage() call, so
it's not even that dynamic resizing isn't working. It's that the
resizing of the canvas (via modifying the style.width and style.height
CSS properties) aren't having any effect; only the <canvas> width and
height attributes seem to matter.
This behavior is also present when the canvas is resized *after* the
drawImage() call. You can repro that by copy/pasting lines 59 and 60
(modifying the style.width and style.height properties) to after the
drawImage() call.
Finally, using Firebug Lite (uncomment lines 9-11, or use a Firebug
Lite bookmarklet), it also seems that the inner elements are sized
very strangely. You can examine like so:
>>> canvas
<canvas contentEditable="inherit" getContext="function () { if
(this.context_) { return this.context_; } return this.context_ = new
CanvasRenderingContext2D_(this); }" width="128" context_="[object
Object]" height="96">
>>> canvas.clientWidth
256
>>> canvas.style.width
"256px"
>>> canvas.firstChild
<div contentEditable="inherit">
>>> canvas.firstChild.clientWidth
256
>>> canvas.firstChild.style.width
"256px"
>>> canvas.firstChild.firstChild
<group contentEditable="inherit">
>>> canvas.firstChild.firstChild.clientWidth
129
>>> canvas.firstChild.firstChild.style.width
"10px"
>>> canvas.firstChild.firstChild.firstChild
<image contentEditable="inherit">
>>> canvas.firstChild.firstChild.firstChild.clientWidth
129
>>> canvas.firstChild.firstChild.firstChild.style.width
"1280px"
You can see that the <canvas> element and its direct inner <div> are
correctly sized, but the two inner <group> and <image> elements aren't
at all. Yet their script and CSS sizes don't match at all their
displayed sizes. Strange.
Aseem