From 17900ce21bfccbe76eb723b05db7118ddbf21e45 Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Mon, 31 Jan 2022 19:56:42 -0500 Subject: [PATCH] Prevent the image preview transparency background from being affected by scaling (#141667) Fixes #141292 --- extensions/image-preview/media/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/image-preview/media/main.js b/extensions/image-preview/media/main.js index 116f2942ed6..ca5d6c56e3a 100644 --- a/extensions/image-preview/media/main.js +++ b/extensions/image-preview/media/main.js @@ -86,8 +86,8 @@ scale = 'fit'; image.classList.add('scale-to-fit'); image.classList.remove('pixelated'); - image.style.minWidth = 'auto'; - image.style.width = 'auto'; + // @ts-ignore Non-standard CSS property + image.style.zoom = 'normal'; vscode.setState(undefined); } else { scale = clamp(newScale, MIN_SCALE, MAX_SCALE); @@ -101,8 +101,8 @@ const dy = (window.scrollY + container.clientHeight / 2) / container.scrollHeight; image.classList.remove('scale-to-fit'); - image.style.minWidth = `${(image.naturalWidth * scale)}px`; - image.style.width = `${(image.naturalWidth * scale)}px`; + // @ts-ignore Non-standard CSS property + image.style.zoom = scale; const newScrollX = container.scrollWidth * dx - container.clientWidth / 2; const newScrollY = container.scrollHeight * dy - container.clientHeight / 2;