From a201ebb3468aa0f5bba9f07f4a5dfc2b56c14805 Mon Sep 17 00:00:00 2001 From: 134 Date: Mon, 6 Jul 2026 19:16:23 +0800 Subject: [PATCH] fix: use mask repair for product lock scale adjust --- app/api/canvas/local-edit/route.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/app/api/canvas/local-edit/route.ts b/app/api/canvas/local-edit/route.ts index f02d7cde6..749243a38 100644 --- a/app/api/canvas/local-edit/route.ts +++ b/app/api/canvas/local-edit/route.ts @@ -5567,14 +5567,15 @@ export async function POST(request: NextRequest) { useScaleAdjustFullFrameStructurePatch && Boolean(scaleAdjustPatchReference?.backgroundPlateFullUrl) && Boolean(scaleAdjustPatchReference?.productLockOverlayUrl); - const useScaleAdjustProductLockGuidedFinal = - useScaleAdjustProductLockComposite && - Boolean(scaleAdjustPatchReference?.targetDraftFullUrl); const useScaleAdjustProductLockMaskEdit = useScaleAdjustProductLockComposite && - !useScaleAdjustProductLockGuidedFinal && isScaleAdjustMaskCapableModel(resolvedScaleAdjustModelEntry) && Boolean(scaleAdjustPatchReference?.productLockEditMaskUrl); + const useScaleAdjustProductLockGuidedFinal = + useScaleAdjustProductLockComposite && + !useScaleAdjustProductLockMaskEdit && + process.env.CANVAS_SCALE_ADJUST_ENABLE_PRODUCT_LOCK_GUIDED_FINAL === "1" && + Boolean(scaleAdjustPatchReference?.targetDraftFullUrl); const useScaleAdjustPatchTargetDraftPrimary = Boolean(scaleAdjustPatchReference); const includeScaleAdjustPatchSourceReference = Boolean(scaleAdjustPatchReference); @@ -5730,8 +5731,20 @@ export async function POST(request: NextRequest) { : []; const scaleAdjustProtectedRegions = isScaleAdjustOperation && scaleAdjustPatchReference - ? scaleAdjustProtectedChangeRegions + ? useScaleAdjustProductLockComposite && useScaleAdjustProductLockMaskEdit + ? [ + scaleAdjustPatchReference.workspaceRect, + ...scaleAdjustProtectedChangeRegions, + ] + : scaleAdjustProtectedChangeRegions : scaleAdjustCompositeRegions; + const scaleAdjustProductLockRepairClipMaskUrl = + useScaleAdjustProductLockComposite && useScaleAdjustProductLockMaskEdit + ? scaleAdjustPatchReference?.productLockBackgroundRepairMaskUrl || + scaleAdjustPatchReference?.productLockEditMaskUrl || + scaleAdjustPatchReference?.compositeClipMaskUrl || + undefined + : scaleAdjustPatchReference?.compositeClipMaskUrl || undefined; const scaleAdjustVerificationConfig = isScaleAdjustOperation ? { allowOutsideChangedWhenChangedInside: false, @@ -6026,8 +6039,7 @@ export async function POST(request: NextRequest) { maskMode: "diff", regions: scaleAdjustPatchCompositeRegions, sourceImageUrl, - clipMaskImageUrl: - scaleAdjustPatchReference?.compositeClipMaskUrl || undefined, + clipMaskImageUrl: scaleAdjustProductLockRepairClipMaskUrl, workspaceRegion: (scaleAdjustPatchReference as ScaleAdjustPatchReference) .workspaceRect,