[gpu] Pinch-rotate around pinch center, not screen center

Adds demo_view_rotate_z_around() which compensates translation
so the point between the two fingers stays fixed during rotation,
like maps apps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behdad EsfahbodandClaude Opus 4.6 committed 2026-03-30 09:40:56 -06:00
1 parent 16c30ac052
commit c1550337db
5 files changed
+38 -5

No files matched your search

+5 -2
View File
@@ -241,8 +241,11 @@ space: animate · b: dark mode · g: gamma · s: stem · d: debug · r: reset ·
if (dAngle < -Math.PI) dAngle += 2 * Math.PI;
if (Math.abs(dAngle) > 0.01) {
pinchAngle = angle;
if (typeof _web_rotate_z === 'function')
_web_rotate_z(dAngle);
if (typeof _web_rotate_z === 'function') {
var mx = (t[0].clientX + t[1].clientX) / 2;
var my = (t[0].clientY + t[1].clientY) / 2;
_web_rotate_z(dAngle, mx, my, canvas.clientWidth, canvas.clientHeight);
}
}
}
}, {passive: false});