From 6b25ca7ec3398731c806ec1fb284505c1dce6d85 Mon Sep 17 00:00:00 2001 From: Han MingYun Date: Thu, 16 Dec 2021 01:40:55 +0800 Subject: [PATCH] fix image left alignment issue --- src/styles/StyleUtils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/styles/StyleUtils.js b/src/styles/StyleUtils.js index e4874f0d546dd..b15366c1f808b 100644 --- a/src/styles/StyleUtils.js +++ b/src/styles/StyleUtils.js @@ -132,8 +132,8 @@ function getZoomSizingStyle(isZoomed, imgWidth, imgHeight, zoomScale, containerH // If image is bigger than container size, display full image in the screen with scaled size (fit by container size) and position absolute. // top, left offset should be different when displaying long or wide image. - const scaledTop = imgHeight > imgWidth ? 0 : `${Math.max((containerHeight - (imgHeight * zoomScale)) / 2, 0)}px`; - const scaledLeft = imgWidth > imgHeight ? 0 : `${Math.max((containerWidth - (imgWidth * zoomScale)) / 2, 0)}px`; + const scaledTop = `${Math.max((containerHeight - (imgHeight * zoomScale)) / 2, 0)}px`; + const scaledLeft = `${Math.max((containerWidth - (imgWidth * zoomScale)) / 2, 0)}px`; return { height: `${imgHeight * zoomScale}px`, width: `${imgWidth * zoomScale}px`,