fix: allow deleting detail scale selections
This commit is contained in:
parent
e1685b517a
commit
6d8aa557bf
@ -1407,6 +1407,9 @@ function DetailResultLocalEditDialog({
|
|||||||
const dialogDescription = isScaleAdjustMode
|
const dialogDescription = isScaleAdjustMode
|
||||||
? "比例模式:先框主体,再框目标大小和位置。"
|
? "比例模式:先框主体,再框目标大小和位置。"
|
||||||
: "局部模式:框选要修改的位置,填写提示词,并可添加参考图。";
|
: "局部模式:框选要修改的位置,填写提示词,并可添加参考图。";
|
||||||
|
const activeScaleRegion = isScaleAdjustMode
|
||||||
|
? regions.find((region) => region.id === activeRegionId) || null
|
||||||
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={Boolean(target)} onOpenChange={(open) => (!open ? onClose() : undefined)}>
|
<Dialog open={Boolean(target)} onOpenChange={(open) => (!open ? onClose() : undefined)}>
|
||||||
@ -1601,6 +1604,32 @@ function DetailResultLocalEditDialog({
|
|||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{activeScaleRegion ? (
|
||||||
|
<button
|
||||||
|
aria-label={`删除区域 ${activeScaleRegion.index}`}
|
||||||
|
className="absolute z-30 flex h-8 w-8 items-center justify-center rounded-full border border-white/50 bg-red-500 text-white shadow-[0_10px_24px_rgba(0,0,0,0.35)] transition hover:bg-red-400 disabled:cursor-not-allowed disabled:opacity-45"
|
||||||
|
disabled={isBusy}
|
||||||
|
onClick={(event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
removeRegion(activeScaleRegion.id);
|
||||||
|
}}
|
||||||
|
onPointerDown={(event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
left: `calc(${
|
||||||
|
(activeScaleRegion.rect.x + activeScaleRegion.rect.width) * 100
|
||||||
|
}% - 34px)`,
|
||||||
|
top: `calc(${activeScaleRegion.rect.y * 100}% + 8px)`,
|
||||||
|
}}
|
||||||
|
title="删除当前框选"
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<X className="h-4 w-4" />
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
{isScaleAdjustMode
|
{isScaleAdjustMode
|
||||||
? regions
|
? regions
|
||||||
.filter((region) => region.targetRect)
|
.filter((region) => region.targetRect)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user