fix: remove psd layer position controls
This commit is contained in:
parent
96d9551e54
commit
359b964033
@ -2092,10 +2092,6 @@ export function AgentPsdTemplateEditorDialog({
|
|||||||
? effectiveTextPositionOffsets[selectedTextLayer.id] ||
|
? effectiveTextPositionOffsets[selectedTextLayer.id] ||
|
||||||
normalizeTextPositionOffset()
|
normalizeTextPositionOffset()
|
||||||
: normalizeTextPositionOffset();
|
: normalizeTextPositionOffset();
|
||||||
const selectedLayerPositionOffset = selectedLayer
|
|
||||||
? effectiveLayerPositionOffsets[selectedLayer.id] ||
|
|
||||||
normalizeLayerPositionOffset()
|
|
||||||
: normalizeLayerPositionOffset();
|
|
||||||
const isSelectedImageExtending = Boolean(
|
const isSelectedImageExtending = Boolean(
|
||||||
selectedImageLayer && extendingSlotId === selectedImageLayer.id
|
selectedImageLayer && extendingSlotId === selectedImageLayer.id
|
||||||
);
|
);
|
||||||
@ -2118,16 +2114,16 @@ export function AgentPsdTemplateEditorDialog({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setHiddenLayerIds((current) =>
|
setHiddenLayerIds((current) =>
|
||||||
current.filter((currentLayerId) => currentLayerId !== normalizedLayerId)
|
current.filter((currentLayerId) => currentLayerId !== normalizedLayerId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const selectedLayerPositionPanel = selectedLayer ? (
|
const selectedLayerPositionPanel = selectedLayer ? (
|
||||||
<div className="space-y-4 rounded-2xl border border-white/10 bg-white/[0.03] p-5 shadow-inner">
|
<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 className="flex items-start justify-between gap-4">
|
||||||
<div>
|
<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 className="mt-1.5 text-white/50 text-xs">
|
||||||
现在所有图层都支持在中间预览区直接拖动,这里也能做数值微调。
|
选中图层后可调整与其他图层的上下关系。
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Move className="h-5 w-5 shrink-0 text-emerald-300" />
|
<Move className="h-5 w-5 shrink-0 text-emerald-300" />
|
||||||
@ -2168,86 +2164,6 @@ export function AgentPsdTemplateEditorDialog({
|
|||||||
置于最下
|
置于最下
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
const selectedImageAdjustmentPanel = selectedImageLayer ? (
|
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(
|
function moveLayerOrder(
|
||||||
layerId: string,
|
layerId: string,
|
||||||
direction: "forward" | "backward" | "front" | "back"
|
direction: "forward" | "backward" | "front" | "back"
|
||||||
@ -5039,7 +4936,7 @@ export function AgentPsdTemplateEditorDialog({
|
|||||||
当前是普通图层
|
当前是普通图层
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 text-xs leading-relaxed text-white/45">
|
<div className="mt-2 text-xs leading-relaxed text-white/45">
|
||||||
这个图层当前不支持替换图片或编辑文字,但现在已经支持在预览区直接拖动位置,也可以在上方做数值微调。
|
这个图层当前不支持替换图片或编辑文字,但可以在预览区直接拖动位置,也可以调整上下层级。
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user