Possible duplicate:
Zoom in (using scale and translation)
I want to implement mouse pointer scaling with the mouse wheel. This zooms in on the image, while the point under the mouse pointer remains fixed.
Here is my code that doesn't work very well
var scala = 1 + event.wheelDelta / 1000; canvas.context.translate(-canvas.mouse.x * ( scala - 1 ) / canvas.scale,-canvas.mouse.y * ( scala - 1 ) / canvas.scale); canvas.context.scale(scala,scala); canvas.scale *= scala;
javascript html5 canvas
csiz
source share