From ccf84eb0317c77a6819bb29f548c88f1940db568 Mon Sep 17 00:00:00 2001 From: jingrow Date: Wed, 19 Nov 2025 21:06:32 +0800 Subject: [PATCH] fix comparison image height calculation --- .../src/views/tools/RemoveBackground.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue b/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue index 2cdd0fb..6392f0e 100644 --- a/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue +++ b/apps/jingrow/frontend/src/views/tools/RemoveBackground.vue @@ -928,8 +928,11 @@ h1 { .comparison-container { position: relative; display: inline-block; - max-width: min(90vw, calc(100vh - 200px)); - max-height: min(90vw, calc(100vh - 200px)); + /* 固定尺寸,避免子元素高度计算错误 */ + width: min(90vw, calc(100vh - 200px)); + height: min(90vw, calc(100vh - 200px)); + max-width: 100%; + max-height: 100%; overflow: hidden; border-radius: 8px; border: 1px solid #e5e7eb; @@ -963,10 +966,13 @@ h1 { } .original-image { - position: relative; + /* 和 result-image 一样使用 absolute,确保填充 comparison-container */ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; z-index: 1; - width: auto; - height: auto; /* clip-path 通过内联样式动态设置,用于裁剪显示区域 */ img {