diff --git a/extensions/image-preview/media/main.js b/extensions/image-preview/media/main.js index d756724536e76..94364c28503b7 100644 --- a/extensions/image-preview/media/main.js +++ b/extensions/image-preview/media/main.js @@ -239,6 +239,7 @@ }); container.addEventListener('wheel', (/** @type {WheelEvent} */ e) => { + e.preventDefault(); if (!image || !hasLoadedImage) { return; } @@ -254,9 +255,11 @@ let delta = e.deltaY > 0 ? 1 : -1; updateScale(scale * (1 - delta * SCALE_PINCH_FACTOR)); - }); + }, { passive: false }); + + window.addEventListener('scroll', e => { + e.preventDefault(); - window.addEventListener('scroll', () => { if (!image || !hasLoadedImage || !image.parentElement || scale === 'fit') { return; } @@ -265,7 +268,7 @@ if (entry) { vscode.setState({ scale: entry.scale, offsetX: window.scrollX, offsetY: window.scrollY }); } - }); + }, { passive: false }); container.classList.add('image');