D
DL
It seems pretty straight-forward to simply resize a canvas, code like
thie following would do:
var c = document.getElementById('canvas');
c.height = c.height + 15;
c.width = c.width + 15;
However, this resized canvas would appear empty.
How does it work? Could I create a hidden element, a) upon the resize
event trigger a copy of the canvas element to the hidden element; b)
then do the canvas resizing and c) then copy it/them back to the
canvas?
And if the above approach is the right way?
Step one seems critical,
// a) copy the original canvas content to the temp element named
canvastemp
var canvastemp = document.getElementById("canvastemp");
var ctemp = canvastemp.getContext("2d");
// duplicate the temp object from the original canvas object
canvastemp = c;
Not working, what's wrong?
Thanks.
thie following would do:
var c = document.getElementById('canvas');
c.height = c.height + 15;
c.width = c.width + 15;
However, this resized canvas would appear empty.
How does it work? Could I create a hidden element, a) upon the resize
event trigger a copy of the canvas element to the hidden element; b)
then do the canvas resizing and c) then copy it/them back to the
canvas?
And if the above approach is the right way?
Step one seems critical,
// a) copy the original canvas content to the temp element named
canvastemp
var canvastemp = document.getElementById("canvastemp");
var ctemp = canvastemp.getContext("2d");
// duplicate the temp object from the original canvas object
canvastemp = c;
Not working, what's wrong?
Thanks.