I'm currently implementing a HTML canvas based webapp that features panning. Is there a way to use an auxiliary buffer to hold the presently visible area so when I pan I don't have to redraw the whole canvas and only have to draw the newly visible areas?
+1
A:
Take a look at the pixel manipulation API. http://dev.w3.org/html5/2dcontext/#pixel-manipulation
swampsjohn
2010-03-06 01:14:40
+1
A:
See my previous response to a related question: http://stackoverflow.com/questions/2041148/what-is-the-fastest-way-to-move-a-rectangular-pixel-region-inside-a-html5-canva/2041249#2041249
Just draw the entire canvas in a div that has overflow:hidden and implement panning as re-positioning the top and left of the canvas within that div. It is much faster. And don't worry about drawing canvases tens of thousands of pixels wide/tall, I've successfully used this on very-very large and complex HTML and SVG elements.
slebetman
2010-03-06 02:06:32