fix: remove psd layer position controls
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-05-14 16:22:59 +08:00
parent 96d9551e54
commit 359b964033

View File

@ -2092,10 +2092,6 @@ export function AgentPsdTemplateEditorDialog({
? effectiveTextPositionOffsets[selectedTextLayer.id] ||
normalizeTextPositionOffset()
: normalizeTextPositionOffset();
const selectedLayerPositionOffset = selectedLayer
? effectiveLayerPositionOffsets[selectedLayer.id] ||
normalizeLayerPositionOffset()
: normalizeLayerPositionOffset();
const isSelectedImageExtending = Boolean(
selectedImageLayer && extendingSlotId === selectedImageLayer.id
);
@ -2118,16 +2114,16 @@ export function AgentPsdTemplateEditorDialog({
return;
}
setHiddenLayerIds((current) =>
current.filter((currentLayerId) => currentLayerId !== normalizedLayerId)
current.filter((currentLayerId) => currentLayerId !== normalizedLayerId)
);
}
const selectedLayerPositionPanel = selectedLayer ? (
<div className="space-y-4 rounded-2xl border border-white/10 bg-white/[0.03] p-5 shadow-inner">
<div className="flex items-start justify-between gap-4">
<div>
<div className="font-semibold text-sm text-white">图层位置</div>
<div className="font-semibold text-sm text-white">图层层级</div>
<div className="mt-1.5 text-white/50 text-xs">
现在所有图层都支持在中间预览区直接拖动,这里也能做数值微调。
选中图层后可调整与其他图层的上下关系。
</div>
</div>
<Move className="h-5 w-5 shrink-0 text-emerald-300" />
@ -2168,86 +2164,6 @@ export function AgentPsdTemplateEditorDialog({
置于最下
</Button>
</div>
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1.5">
<Label className="text-white/50 text-xs">水平 X</Label>
<Input
className="h-10 rounded-xl border-white/10 bg-black/20 text-white"
inputMode="numeric"
onChange={(event) => {
const nextValue = Number(event.target.value);
if (!Number.isFinite(nextValue)) return;
updateLayerPositionOffset(selectedLayer.id, () => ({
offsetX: nextValue,
}));
}}
type="number"
value={Math.round(selectedLayerPositionOffset.offsetX)}
/>
</div>
<div className="space-y-1.5">
<Label className="text-white/50 text-xs">垂直 Y</Label>
<Input
className="h-10 rounded-xl border-white/10 bg-black/20 text-white"
inputMode="numeric"
onChange={(event) => {
const nextValue = Number(event.target.value);
if (!Number.isFinite(nextValue)) return;
updateLayerPositionOffset(selectedLayer.id, () => ({
offsetY: nextValue,
}));
}}
type="number"
value={Math.round(selectedLayerPositionOffset.offsetY)}
/>
</div>
</div>
<div className="grid grid-cols-[1fr_auto_1fr] items-center gap-2">
<div />
<Button
className="h-9 w-12 justify-self-center rounded-xl border-white/10 bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white"
onClick={() => nudgeLayerPositionOffset(selectedLayer.id, 0, -1)}
type="button"
variant="outline"
>
↑
</Button>
<div />
<Button
className="h-9 w-12 justify-self-center rounded-xl border-white/10 bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white"
onClick={() => nudgeLayerPositionOffset(selectedLayer.id, -1, 0)}
type="button"
variant="outline"
>
←
</Button>
<Button
className="h-9 justify-self-center rounded-xl border-white/10 bg-white/[0.04] px-3 text-white/60 hover:bg-white/[0.08] hover:text-white"
onClick={() => resetLayerPositionOffset(selectedLayer.id)}
type="button"
variant="outline"
>
归零
</Button>
<Button
className="h-9 w-12 justify-self-center rounded-xl border-white/10 bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white"
onClick={() => nudgeLayerPositionOffset(selectedLayer.id, 1, 0)}
type="button"
variant="outline"
>
→
</Button>
<div />
<Button
className="h-9 w-12 justify-self-center rounded-xl border-white/10 bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white"
onClick={() => nudgeLayerPositionOffset(selectedLayer.id, 0, 1)}
type="button"
variant="outline"
>
↓
</Button>
<div />
</div>
</div>
) : null;
const selectedImageAdjustmentPanel = selectedImageLayer ? (
@ -3087,25 +3003,6 @@ export function AgentPsdTemplateEditorDialog({
}));
}
function nudgeLayerPositionOffset(
layerId: string,
deltaX: number,
deltaY: number
) {
updateLayerPositionOffset(layerId, (current) => ({
offsetX: current.offsetX + deltaX,
offsetY: current.offsetY + deltaY,
}));
}
function resetLayerPositionOffset(layerId: string) {
setLayerPositionOffsets((current) => {
const next = { ...current };
delete next[layerId];
return next;
});
}
function moveLayerOrder(
layerId: string,
direction: "forward" | "backward" | "front" | "back"
@ -5039,7 +4936,7 @@ export function AgentPsdTemplateEditorDialog({
当前是普通图层
</div>
<div className="mt-2 text-xs leading-relaxed text-white/45">
这个图层当前不支持替换图片或编辑文字,但现在已经支持在预览区直接拖动位置,也可以在上方做数值微调。
这个图层当前不支持替换图片或编辑文字,但可以在预览区直接拖动位置,也可以调整上下层级。
</div>
</div>
</div>