가능한 중복은 :
Zoom in on a point (using scale and translate)구현 줌, 자바 스크립트/캔버스
나는 마우스 휠과 마우스 포인터에 확대 구현하려는. 그것은 마우스 포인터 아래의 점이 고정 된 상태에서 이미지 크기를 조절하는 것입니다. 여기
아주 잘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;
//canvas.scale is my variable that is initially set to 1.
//canvas.mouse is my variable that represents the mouse position relative to the canvas
아무것도하지 않거나 제대로 작동하지 않는 제대로 – Eric
행동하지 않는, mouse.x는 조정 좌표를 사용하여 번역하면서, 그건 좌표 창에 내가 생각하는 곳은 문제 다. – csiz
또한 제가 척도 (1.3,1.3)를 사용한다면, 척도 (0.7,0.7); 객체는 원래 위치로 돌아가지만 1 * 1.3 * 0.7! = 1 – csiz