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) /
|
((sourceCenterY - placement.sourceFootprintBox.top) /
|
||||||
Math.max(1, placement.sourceFootprintBox.height)) *
|
Math.max(1, placement.sourceFootprintBox.height)) *
|
||||||
placement.targetBox.height;
|
placement.targetBox.height;
|
||||||
const useRectCropTargetGuide = preferPixelStructure && Boolean(protectedPersonSide);
|
const structureOverlay = await sharp(subjectCrop, { failOn: "none" })
|
||||||
const structureOverlay = useRectCropTargetGuide
|
.joinChannel(subjectAlpha)
|
||||||
? await sharp(sourceBuffer, { failOn: "none" })
|
.resize(placedWidth, placedHeight, {
|
||||||
.extract(placement.sourceBox)
|
fit: "fill",
|
||||||
.resize(placement.placedWidth, placement.placedHeight, {
|
kernel: sharp.kernel.lanczos3,
|
||||||
fit: "fill",
|
})
|
||||||
kernel: sharp.kernel.lanczos3,
|
.png({ compressionLevel: 6 })
|
||||||
})
|
.toBuffer();
|
||||||
.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 targetClipMaskPatch =
|
const targetClipMaskPatch =
|
||||||
await buildScaleAdjustOverlayClipMaskPatch(structureOverlay);
|
await buildScaleAdjustOverlayClipMaskPatch(structureOverlay);
|
||||||
const overlayLeft = useRectCropTargetGuide
|
const overlayLeft = Math.round(targetCenterX - placedWidth / 2);
|
||||||
? placement.placedLeft
|
const overlayTop = Math.round(targetCenterY - placedHeight / 2);
|
||||||
: Math.round(targetCenterX - placedWidth / 2);
|
|
||||||
const overlayTop = useRectCropTargetGuide
|
|
||||||
? placement.placedTop
|
|
||||||
: Math.round(targetCenterY - placedHeight / 2);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
compositeClip: {
|
compositeClip: {
|
||||||
@ -2974,7 +2950,7 @@ async function buildScaleAdjustStructureLockedComposite(params: {
|
|||||||
left: placement.sourceBox.left,
|
left: placement.sourceBox.left,
|
||||||
top: placement.sourceBox.top,
|
top: placement.sourceBox.top,
|
||||||
},
|
},
|
||||||
method: useRectCropTargetGuide ? "rect-crop-guide" : "pixel-mask",
|
method: "pixel-mask",
|
||||||
overlay: {
|
overlay: {
|
||||||
input: structureOverlay,
|
input: structureOverlay,
|
||||||
left: overlayLeft,
|
left: overlayLeft,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user