fix: use mask repair for product lock scale adjust

This commit is contained in:
134 2026-07-06 19:16:23 +08:00
parent bf5d10f99f
commit a201ebb346

View File

@ -5567,14 +5567,15 @@ export async function POST(request: NextRequest) {
useScaleAdjustFullFrameStructurePatch && useScaleAdjustFullFrameStructurePatch &&
Boolean(scaleAdjustPatchReference?.backgroundPlateFullUrl) && Boolean(scaleAdjustPatchReference?.backgroundPlateFullUrl) &&
Boolean(scaleAdjustPatchReference?.productLockOverlayUrl); Boolean(scaleAdjustPatchReference?.productLockOverlayUrl);
const useScaleAdjustProductLockGuidedFinal =
useScaleAdjustProductLockComposite &&
Boolean(scaleAdjustPatchReference?.targetDraftFullUrl);
const useScaleAdjustProductLockMaskEdit = const useScaleAdjustProductLockMaskEdit =
useScaleAdjustProductLockComposite && useScaleAdjustProductLockComposite &&
!useScaleAdjustProductLockGuidedFinal &&
isScaleAdjustMaskCapableModel(resolvedScaleAdjustModelEntry) && isScaleAdjustMaskCapableModel(resolvedScaleAdjustModelEntry) &&
Boolean(scaleAdjustPatchReference?.productLockEditMaskUrl); 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 useScaleAdjustPatchTargetDraftPrimary = Boolean(scaleAdjustPatchReference);
const includeScaleAdjustPatchSourceReference = const includeScaleAdjustPatchSourceReference =
Boolean(scaleAdjustPatchReference); Boolean(scaleAdjustPatchReference);
@ -5730,8 +5731,20 @@ export async function POST(request: NextRequest) {
: []; : [];
const scaleAdjustProtectedRegions = const scaleAdjustProtectedRegions =
isScaleAdjustOperation && scaleAdjustPatchReference isScaleAdjustOperation && scaleAdjustPatchReference
? scaleAdjustProtectedChangeRegions ? useScaleAdjustProductLockComposite && useScaleAdjustProductLockMaskEdit
? [
scaleAdjustPatchReference.workspaceRect,
...scaleAdjustProtectedChangeRegions,
]
: scaleAdjustProtectedChangeRegions
: scaleAdjustCompositeRegions; : scaleAdjustCompositeRegions;
const scaleAdjustProductLockRepairClipMaskUrl =
useScaleAdjustProductLockComposite && useScaleAdjustProductLockMaskEdit
? scaleAdjustPatchReference?.productLockBackgroundRepairMaskUrl ||
scaleAdjustPatchReference?.productLockEditMaskUrl ||
scaleAdjustPatchReference?.compositeClipMaskUrl ||
undefined
: scaleAdjustPatchReference?.compositeClipMaskUrl || undefined;
const scaleAdjustVerificationConfig = isScaleAdjustOperation const scaleAdjustVerificationConfig = isScaleAdjustOperation
? { ? {
allowOutsideChangedWhenChangedInside: false, allowOutsideChangedWhenChangedInside: false,
@ -6026,8 +6039,7 @@ export async function POST(request: NextRequest) {
maskMode: "diff", maskMode: "diff",
regions: scaleAdjustPatchCompositeRegions, regions: scaleAdjustPatchCompositeRegions,
sourceImageUrl, sourceImageUrl,
clipMaskImageUrl: clipMaskImageUrl: scaleAdjustProductLockRepairClipMaskUrl,
scaleAdjustPatchReference?.compositeClipMaskUrl || undefined,
workspaceRegion: workspaceRegion:
(scaleAdjustPatchReference as ScaleAdjustPatchReference) (scaleAdjustPatchReference as ScaleAdjustPatchReference)
.workspaceRect, .workspaceRect,