diff --git a/src/Components/PhotoViewer.tsx b/src/Components/PhotoViewer.tsx
index afaedf6..a277439 100644
--- a/src/Components/PhotoViewer.tsx
+++ b/src/Components/PhotoViewer.tsx
@@ -150,6 +150,28 @@ let PhotoViewer = () => {
})
}
+ let resizeImage = () => {
+ let dstWidth;
+ let dstHeight;
+
+ let imgHeight = imageViewer.height;
+ let imgWidth = imageViewer.width;
+
+ if(
+ imgWidth / window.innerWidth <
+ imgHeight / window.innerHeight
+ ) {
+ dstWidth = imgWidth * (window.innerHeight / imgHeight);
+ dstHeight = window.innerHeight;
+ } else{
+ dstWidth = window.innerWidth;
+ dstHeight = imgHeight * (window.innerWidth / imgWidth);
+ }
+
+ imageViewer.style.width = dstWidth + 'px';
+ imageViewer.style.height = dstHeight + 'px';
+ }
+
onMount(() => {
utils.set(photoControls, { translateX: '-50%' });
utils.set(photoTrayCloseBtn, { translateX: '-50%', opacity: 0, scale: '0.75', bottom: '10px' });
@@ -157,6 +179,10 @@ let PhotoViewer = () => {
window.addEventListener('keyup', switchPhotoWithKey);
+ resizeImage();
+
+ window.addEventListener('resize', () => resizeImage());
+
let contextMenuOpen = false;
window.CloseAllPopups.push(() => {
contextMenuOpen = false;
@@ -465,7 +491,16 @@ let PhotoViewer = () => {
-
imageViewer = el} />
+
+