From 443bd203ca01f24deaac2123b5408d3c0b60d8cd Mon Sep 17 00:00:00 2001 From: caadiq Date: Mon, 12 Jan 2026 16:08:00 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EA=B0=A4?= =?UTF-8?q?=EB=9F=AC=EB=A6=AC:=20=EB=86=92=EC=9D=B4=20=EA=B8=B0=EB=B0=98?= =?UTF-8?q?=20=EA=B7=A0=EB=93=B1=20=EB=B6=84=EB=B0=B0=20=EC=95=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=EC=A6=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/mobile/public/AlbumGallery.jsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/mobile/public/AlbumGallery.jsx b/frontend/src/pages/mobile/public/AlbumGallery.jsx index 3b5c184..964d700 100644 --- a/frontend/src/pages/mobile/public/AlbumGallery.jsx +++ b/frontend/src/pages/mobile/public/AlbumGallery.jsx @@ -109,16 +109,24 @@ function MobileAlbumGallery() { return () => { document.body.style.overflow = ''; }; }, [selectedIndex]); - // 사진을 2열 지그재그로 분배 + // 사진을 2열로 균등 분배 (높이 기반) const distributePhotos = () => { const leftColumn = []; const rightColumn = []; + let leftHeight = 0; + let rightHeight = 0; photos.forEach((photo, index) => { - if (index % 2 === 0) { + // 이미지 높이 비율 계산 (width가 동일하다고 가정하면 height/width 비율 사용) + const aspectRatio = photo.height && photo.width ? photo.height / photo.width : 1; + + // 더 짧은 열에 사진 추가 + if (leftHeight <= rightHeight) { leftColumn.push({ ...photo, originalIndex: index }); + leftHeight += aspectRatio; } else { rightColumn.push({ ...photo, originalIndex: index }); + rightHeight += aspectRatio; } }); @@ -208,10 +216,6 @@ function MobileAlbumGallery() { /> ))} - {/* 홀수개일 때 오른쪽 열 하단에 빈 공간 방지용 플레이스홀더 */} - {photos.length % 2 === 1 && ( -
- )}