This commit is contained in:
33333-33333 2026-09-29 19:10:03 +09:00
commit 01204dfa2f
34 changed files with 1498 additions and 0 deletions

5
gestures.js Normal file
View file

@ -0,0 +1,5 @@
// Keep the world point under the gesture midpoint while fingers move or zoom.
export function pinchCamera(start,a,b,rect,view,worldWidth,worldHeight){
const zoom=Math.max(1,Math.min(32,start.zoom*Math.hypot(a.x-b.x,a.y-b.y)/start.distance)),s=zoom*view.base;
return {zoom,panX:(a.x+b.x)/2-rect.left-start.anchorX*s-(view.width-worldWidth*s)/2,panY:(a.y+b.y)/2-rect.top-start.anchorY*s-(view.height-worldHeight*s)/2};
}