diff --git a/extensions/image-preview/media/main.js b/extensions/image-preview/media/main.js index a657ca04e4025cfbe4c80aa2ebaedce290aa74f8..bc1e25a4bdf613ef0ed6e2bb5eef45ac9bbca93e 100644 --- a/extensions/image-preview/media/main.js +++ b/extensions/image-preview/media/main.js @@ -241,7 +241,11 @@ }); container.addEventListener('wheel', (/** @type {WheelEvent} */ e) => { - e.preventDefault(); + // Prevent pinch to zoom + if (e.ctrlKey) { + e.preventDefault(); + } + if (!image || !hasLoadedImage) { return; } @@ -260,8 +264,6 @@ }, { passive: false }); window.addEventListener('scroll', e => { - e.preventDefault(); - if (!image || !hasLoadedImage || !image.parentElement || scale === 'fit') { return; } @@ -270,7 +272,7 @@ if (entry) { vscode.setState({ scale: entry.scale, offsetX: window.scrollX, offsetY: window.scrollY }); } - }, { passive: false }); + }, { passive: true }); container.classList.add('image'); diff --git a/extensions/image-preview/src/preview.ts b/extensions/image-preview/src/preview.ts index 7b859877304b894e1aba76898d4515fdcd665dfe..962ea5e48664f706dd1510d905e76afc8d6c5728 100644 --- a/extensions/image-preview/src/preview.ts +++ b/extensions/image-preview/src/preview.ts @@ -203,8 +203,11 @@ class Preview extends Disposable {
- - + + + +