mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Prevent default zoom behavior in image preview for browsers
This commit is contained in:
parent
175b3fefd7
commit
31f577ec88
|
@ -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');
|
||||
|
||||
|
|
Loading…
Reference in a new issue