fix(rsocials): two-finger trackpad pans, pinch/ctrl+scroll zooms

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-12 00:28:19 -07:00
parent 456d0de9c1
commit c0de770e70
1 changed files with 12 additions and 4 deletions

View File

@ -766,12 +766,20 @@ class FolkCampaignWorkflow extends HTMLElement {
}); });
this.shadow.getElementById('zoom-fit')?.addEventListener('click', () => this.fitView()); this.shadow.getElementById('zoom-fit')?.addEventListener('click', () => this.fitView());
// Canvas mouse wheel // Canvas wheel: two-finger trackpad = pan, Ctrl+wheel / pinch = zoom
canvas.addEventListener('wheel', (e: WheelEvent) => { canvas.addEventListener('wheel', (e: WheelEvent) => {
e.preventDefault(); e.preventDefault();
const rect = svg.getBoundingClientRect(); if (e.ctrlKey || e.metaKey) {
const factor = e.deltaY < 0 ? 1.1 : 0.9; // Pinch-to-zoom or Ctrl+scroll
this.zoomAt(e.clientX - rect.left, e.clientY - rect.top, factor); const rect = svg.getBoundingClientRect();
const factor = e.deltaY < 0 ? 1.1 : 0.9;
this.zoomAt(e.clientX - rect.left, e.clientY - rect.top, factor);
} else {
// Two-finger swipe = pan
this.canvasPanX -= e.deltaX;
this.canvasPanY -= e.deltaY;
this.updateCanvasTransform();
}
}, { passive: false }); }, { passive: false });
// Palette drag // Palette drag