fix: keep furniture scale drafts mask based
This commit is contained in:
parent
14e75197cf
commit
fa5212a33e
@ -2931,42 +2931,18 @@ async function buildScaleAdjustStructureLockedComposite(params: {
|
||||
((sourceCenterY - placement.sourceFootprintBox.top) /
|
||||
Math.max(1, placement.sourceFootprintBox.height)) *
|
||||
placement.targetBox.height;
|
||||
const useRectCropTargetGuide = preferPixelStructure && Boolean(protectedPersonSide);
|
||||
const structureOverlay = useRectCropTargetGuide
|
||||
? await sharp(sourceBuffer, { failOn: "none" })
|
||||
.extract(placement.sourceBox)
|
||||
.resize(placement.placedWidth, placement.placedHeight, {
|
||||
fit: "fill",
|
||||
kernel: sharp.kernel.lanczos3,
|
||||
})
|
||||
.ensureAlpha()
|
||||
.composite([
|
||||
{
|
||||
input: buildScaleAdjustPatchMaskSvg({
|
||||
height: placement.placedHeight,
|
||||
width: placement.placedWidth,
|
||||
}),
|
||||
blend: "dest-in",
|
||||
},
|
||||
])
|
||||
.png({ compressionLevel: 6 })
|
||||
.toBuffer()
|
||||
: await sharp(subjectCrop, { failOn: "none" })
|
||||
.joinChannel(subjectAlpha)
|
||||
.resize(placedWidth, placedHeight, {
|
||||
fit: "fill",
|
||||
kernel: sharp.kernel.lanczos3,
|
||||
})
|
||||
.png({ compressionLevel: 6 })
|
||||
.toBuffer();
|
||||
const structureOverlay = await sharp(subjectCrop, { failOn: "none" })
|
||||
.joinChannel(subjectAlpha)
|
||||
.resize(placedWidth, placedHeight, {
|
||||
fit: "fill",
|
||||
kernel: sharp.kernel.lanczos3,
|
||||
})
|
||||
.png({ compressionLevel: 6 })
|
||||
.toBuffer();
|
||||
const targetClipMaskPatch =
|
||||
await buildScaleAdjustOverlayClipMaskPatch(structureOverlay);
|
||||
const overlayLeft = useRectCropTargetGuide
|
||||
? placement.placedLeft
|
||||
: Math.round(targetCenterX - placedWidth / 2);
|
||||
const overlayTop = useRectCropTargetGuide
|
||||
? placement.placedTop
|
||||
: Math.round(targetCenterY - placedHeight / 2);
|
||||
const overlayLeft = Math.round(targetCenterX - placedWidth / 2);
|
||||
const overlayTop = Math.round(targetCenterY - placedHeight / 2);
|
||||
|
||||
return {
|
||||
compositeClip: {
|
||||
@ -2974,7 +2950,7 @@ async function buildScaleAdjustStructureLockedComposite(params: {
|
||||
left: placement.sourceBox.left,
|
||||
top: placement.sourceBox.top,
|
||||
},
|
||||
method: useRectCropTargetGuide ? "rect-crop-guide" : "pixel-mask",
|
||||
method: "pixel-mask",
|
||||
overlay: {
|
||||
input: structureOverlay,
|
||||
left: overlayLeft,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user