From 026164f86d6bb2d507a986d064abbcc00d63be58 Mon Sep 17 00:00:00 2001 From: 134 Date: Fri, 3 Jul 2026 22:07:46 +0800 Subject: [PATCH] fix: ignore top background sheets in scale masks --- app/api/canvas/local-edit/route.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/api/canvas/local-edit/route.ts b/app/api/canvas/local-edit/route.ts index 443f8aefc..04a54f42f 100644 --- a/app/api/canvas/local-edit/route.ts +++ b/app/api/canvas/local-edit/route.ts @@ -1425,8 +1425,16 @@ function filterScaleAdjustStructureComponents(params: { const componentBoxArea = Math.max(1, componentWidth * componentHeight); const componentDensity = area / componentBoxArea; const centerXRatio = (minX + componentWidth / 2) / width; + const centerYRatio = (minY + componentHeight / 2) / height; + const touchesTop = minY <= height * 0.04; const touchesRight = maxX >= width * 0.88; const edgeSliver = touchesRight && componentWidth < width * 0.18; + const broadTopBackground = + touchesTop && + centerYRatio <= 0.45 && + componentWidth >= width * 0.42 && + componentHeight >= height * 0.18 && + componentDensity >= 0.18; const elongated = componentHeight > componentWidth * 2.4 || componentWidth > componentHeight * 2.4; @@ -1442,7 +1450,12 @@ function filterScaleAdjustStructureComponents(params: { componentDensity >= 0.035 && componentDensity <= 0.72; - if (likelyStructure && centeredEnough && !edgeSliver) { + if ( + likelyStructure && + centeredEnough && + !edgeSliver && + !broadTopBackground + ) { if (fillSurfaceComponent) { for (let fillY = minY; fillY <= maxY; fillY += 1) { for (let fillX = minX; fillX <= maxX; fillX += 1) {