fix: clear protected side from scale drafts

This commit is contained in:
134 2026-07-05 13:34:54 +08:00
parent acdc197b7e
commit 0f27bf1b10

View File

@ -2678,9 +2678,12 @@ function suppressScaleAdjustProtectedFurnitureDarkAlpha(params: {
luma < 150 &&
(saturation < 0.55 || (r < 110 && g < 110 && b < 110));
const lowContrastDark = luma < 132 && saturation < 0.32;
const shouldClear = inProtectedSideArea
? neutralDark || lowContrastDark
: luma < 100 || (luma < 132 && saturation < 0.22);
const shouldClear =
inProtectedSideArea ||
neutralDark ||
lowContrastDark ||
luma < 100 ||
(luma < 132 && saturation < 0.22);
if (!shouldClear) continue;
output[alphaIndex] = 0;
@ -3128,6 +3131,43 @@ async function buildScaleAdjustVisualLayoutGuideBuffer(params: {
if (structureLockAppliedRef) {
structureLockAppliedRef.value = true;
}
if (protectedPersonSide && sourceRaw) {
const washRight =
protectedPersonSide === "right"
? Math.round(placement.sourceFootprintBox.width * 0.74)
: placement.sourceFootprintBox.width;
const washLeft =
protectedPersonSide === "left"
? placement.sourceFootprintBox.left +
Math.round(placement.sourceFootprintBox.width * 0.26)
: placement.sourceFootprintBox.left;
const washWidth =
protectedPersonSide === "left"
? Math.max(
1,
placement.sourceFootprintBox.width -
Math.round(placement.sourceFootprintBox.width * 0.26)
)
: Math.max(1, washRight);
sourceFootprintBoxes.push({
left: washLeft,
top: placement.sourceFootprintBox.top,
width: washWidth,
height: placement.sourceFootprintBox.height,
background: estimateScaleAdjustBoxBackground({
box: {
left: washLeft,
top: placement.sourceFootprintBox.top,
width: washWidth,
height: placement.sourceFootprintBox.height,
},
raw: sourceRaw,
width: sourceWidth,
}),
innerOpacity: 0.5,
opacity: 0.72,
});
}
subjectWashComposites.push(structureLockedComposite.wash);
if (structureLockedComposite.compositeClip) {
compositeClipComposites.push(structureLockedComposite.compositeClip);
@ -4966,7 +5006,7 @@ export async function POST(request: NextRequest) {
scaleAdjustPromptStrategy: isScaleAdjustOperation
? scaleAdjustPatchReference
? useScaleAdjustFullFrameStructurePatch
? "full-frame-structure-locked-draft-v6-protected-side-dark-cleared-one-shot"
? "full-frame-structure-locked-draft-v7-protected-side-cleared-one-shot"
: scaleAdjustPatchReference.structureLockedDraft
? "ai-patch-workspace-structure-locked-draft-v87-subject-alpha-clipped-one-shot"
: "ai-patch-workspace-draft-v75-soft-wipe-erase-ghost-one-shot"