+ const touch = e.touches ? e.touches[0] : e;
+ let pos = [touch.pageX, touch.pageY];
+ if (e.type === 'touchmove' && e.touches.length > 1) {
+ // distance to second point
+ pos[0] -= e.touches[1].pageX;
+ pos[1] -= e.touches[1].pageY;
+ const span = Math.sqrt(pos[0]**2 + pos[1]**2);
+ if (pinch) {
+ cropzoom(.01 * (span - pinch));
+ }
+ pinch = span;
+ return;
+ }