feat(path-picker): pinch, pan and wheel zoom for the image preview

The path picker's image preview gets zoom controls (out, fit/percentage,
in), a two-finger pinch that keeps the pinch centre in place, one-finger
pan while zoomed (clamped to the image bounds), double-click to toggle
2x, and wheel zoom on desktop. closePreview() removes every listener and
drops the zoom state.

Salvaged from #608.
This commit is contained in:
shenlvkang-collab authored and Codeman maintainer committed 2026-11-09 03:09:45 +01:00
1 parent f62c1f7e2f
commit ba6bff388a
3 files changed
+174 -4

No files matched your search

+9
View File
@@ -169,6 +169,15 @@ describe('mobile filesystem picker actions', () => {
expect(keyboardSource).toContain('pre.textContent = content');
});
it('supports pinch zoom, pan, and explicit zoom controls in image previews', () => {
expect(keyboardSource).toContain("entry.previewKind === 'image'");
expect(keyboardSource).toContain("listen(image, 'pointerdown'");
expect(keyboardSource).toContain("listen(image, 'pointermove'");
expect(keyboardSource).toContain("listen(image, 'dblclick'");
expect(keyboardSource).toContain('data-zoom="fit"');
expect(keyboardSource).toContain('this._previewImageCleanup?.()');
});
it('inserts a selected path into the editable local-echo prompt without sending it', () => {
const appendText = vi.fn();
const sendInput = vi.fn();