提交 31f577ec 编写于 作者: M Matt Bierner

Prevent default zoom behavior in image preview for browsers

上级 175b3fef
......@@ -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');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册