fix: erase old scale footprint in structure drafts

This commit is contained in:
134 2026-07-04 15:58:43 +08:00
parent fb11a4becd
commit 28d73fd042

View File

@ -1178,7 +1178,9 @@ function formatScaleAdjustWashColor(
function buildScaleAdjustSourceFootprintWashSvg(params: {
boxes: Array<{
background?: { b: number; g: number; r: number } | null;
innerOpacity?: number;
left: number;
opacity?: number;
top: number;
width: number;
height: number;
@ -1220,11 +1222,19 @@ function buildScaleAdjustSourceFootprintWashSvg(params: {
const innerRight = Math.min(width, box.left + box.width - pad);
const innerBottom = Math.min(height, box.top + box.height - pad);
const fill = formatScaleAdjustWashColor(box.background);
const opacity =
typeof box.opacity === "number"
? clamp(box.opacity, 0, 1)
: SCALE_ADJUST_LAYOUT_GUIDE_WASH_OPACITY;
const innerOpacity =
typeof box.innerOpacity === "number"
? clamp(box.innerOpacity, 0, 1)
: 0.18;
const inner =
innerRight > innerLeft + 4 && innerBottom > innerTop + 4
? `<rect x="${innerLeft}" y="${innerTop}" width="${innerRight - innerLeft}" height="${innerBottom - innerTop}" rx="${Math.max(4, Math.round(radius * 0.65))}" ry="${Math.max(4, Math.round(radius * 0.65))}" fill="${fill}" fill-opacity="0.18" filter="url(#soft-wash-${index})" />`
? `<rect x="${innerLeft}" y="${innerTop}" width="${innerRight - innerLeft}" height="${innerBottom - innerTop}" rx="${Math.max(4, Math.round(radius * 0.65))}" ry="${Math.max(4, Math.round(radius * 0.65))}" fill="${fill}" fill-opacity="${innerOpacity}" filter="url(#soft-wash-${index})" />`
: "";
return `<rect x="${left}" y="${top}" width="${rectWidth}" height="${rectHeight}" rx="${radius}" ry="${radius}" fill="${fill}" fill-opacity="${SCALE_ADJUST_LAYOUT_GUIDE_WASH_OPACITY}" filter="url(#soft-wash-${index})" />${inner}`;
return `<rect x="${left}" y="${top}" width="${rectWidth}" height="${rectHeight}" rx="${radius}" ry="${radius}" fill="${fill}" fill-opacity="${opacity}" filter="url(#soft-wash-${index})" />${inner}`;
})
.join("");
@ -2602,7 +2612,9 @@ async function buildScaleAdjustVisualLayoutGuideBuffer(params: {
: null;
const sourceFootprintBoxes: Array<{
background?: { b: number; g: number; r: number } | null;
innerOpacity?: number;
left: number;
opacity?: number;
top: number;
width: number;
height: number;
@ -2657,6 +2669,18 @@ async function buildScaleAdjustVisualLayoutGuideBuffer(params: {
if (structureLockAppliedRef) {
structureLockAppliedRef.value = true;
}
sourceFootprintBoxes.push({
...placement.sourceFootprintBox,
background: sourceRaw
? estimateScaleAdjustBoxBackground({
box: placement.sourceFootprintBox,
raw: sourceRaw,
width: sourceWidth,
})
: null,
innerOpacity: 0.36,
opacity: 0.72,
});
subjectWashComposites.push(structureLockedComposite.wash);
composites.push(structureLockedComposite.overlay);
continue;