2026-05-08-03-45-01 调整Mask双图展示
This commit is contained in:
@@ -1015,7 +1015,7 @@ export default function App() {
|
||||
|
||||
const controller = new AbortController();
|
||||
const makeUrl = (index: number) => (
|
||||
`${API_BASE}/api/library/reformat-preview?id=${encodeURIComponent(libraryViewerItem.id)}&plane=${encodeURIComponent(viewerPlane)}&index=${index}&window=${encodeURIComponent(viewerWindow)}&modelId=${encodeURIComponent(stlModel.modelId)}`
|
||||
`${API_BASE}/api/library/reformat-preview?id=${encodeURIComponent(libraryViewerItem.id)}&plane=${encodeURIComponent(viewerPlane)}&index=${index}&window=${encodeURIComponent(viewerWindow)}&modelId=${encodeURIComponent(stlModel.modelId)}&maskOnly=1`
|
||||
);
|
||||
|
||||
setIsModelMaskLoading(true);
|
||||
@@ -2230,33 +2230,46 @@ export default function App() {
|
||||
|
||||
<div className="min-h-[360px] lg:min-h-[560px] bg-slate-950 rounded-2xl border border-slate-900 overflow-hidden flex items-center justify-center relative">
|
||||
{isModelSlicingEnabled && stlModel ? (
|
||||
<div className="w-full h-full grid grid-cols-1 xl:grid-cols-2 gap-0">
|
||||
{[
|
||||
{ label: '起点帧', preview: modelStartPreview, color: 'text-blue-300' },
|
||||
{ label: '终点帧', preview: modelEndPreview, color: 'text-orange-300' },
|
||||
].map(item => (
|
||||
<div key={item.label} className="relative min-h-[330px] flex items-center justify-center border-slate-800 xl:border-l first:border-l-0">
|
||||
{item.preview?.imageUrl && !modelMaskError ? (
|
||||
<img src={`${API_BASE}${item.preview.imageUrl}`} className="w-full h-full object-contain" />
|
||||
) : (
|
||||
<div className="text-center text-white/35">
|
||||
<ImageIcon size={38} className="mx-auto mb-3" />
|
||||
<p className="text-xs font-bold">{modelMaskError || '等待 STL mask'}</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="absolute left-4 top-4 px-3 py-2 rounded-xl bg-black/60 border border-white/10">
|
||||
<p className={`text-[10px] font-black ${item.color}`}>{item.label}</p>
|
||||
<p className="text-[10px] font-mono text-white/70 mt-0.5">
|
||||
{item.preview ? `${item.preview.index + 1} / ${item.preview.count}` : '-'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="absolute right-4 bottom-4 px-3 py-2 rounded-xl bg-black/60 border border-white/10">
|
||||
<p className="text-[10px] font-black text-white/70">
|
||||
MASK {item.preview?.maskPixels ? `${item.preview.maskPixels} px` : '无交集'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="w-full h-full flex flex-col">
|
||||
<div className="px-5 py-4 border-b border-white/10 flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<p className="text-[10px] font-black text-slate-400 uppercase tracking-[0.2em]">Mask 展示</p>
|
||||
<p className="text-[10px] font-bold text-white/55 mt-1">
|
||||
{VIEWER_PLANE_OPTIONS.find(option => option.key === viewerPlane)?.label} · {VIEWER_WINDOW_OPTIONS.find(option => option.key === viewerWindow)?.label}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
<span className="px-3 py-1.5 rounded-full bg-white/10 text-[10px] font-mono font-black text-white/70">
|
||||
{Math.min(clampedModelStart, clampedModelEnd) + 1} - {Math.max(clampedModelStart, clampedModelEnd) + 1}
|
||||
</span>
|
||||
</div>
|
||||
<div className="min-h-0 flex-1 grid grid-cols-1 xl:grid-cols-2 gap-0">
|
||||
{[
|
||||
{ label: '起点帧', preview: modelStartPreview, color: 'text-blue-300' },
|
||||
{ label: '终点帧', preview: modelEndPreview, color: 'text-orange-300' },
|
||||
].map(item => (
|
||||
<div key={item.label} className="relative min-h-[300px] flex items-center justify-center border-slate-800 xl:border-l first:border-l-0">
|
||||
{item.preview?.imageUrl && !modelMaskError ? (
|
||||
<img src={`${API_BASE}${item.preview.imageUrl}`} className="w-full h-full object-contain" />
|
||||
) : (
|
||||
<div className="text-center text-white/35">
|
||||
<ImageIcon size={38} className="mx-auto mb-3" />
|
||||
<p className="text-xs font-bold">{modelMaskError || '等待 STL mask'}</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="absolute left-4 top-4 px-3 py-2 rounded-xl bg-black/60 border border-white/10">
|
||||
<p className={`text-[10px] font-black ${item.color}`}>{item.label}</p>
|
||||
<p className="text-[10px] font-mono text-white/70 mt-0.5">
|
||||
{item.preview ? `${item.preview.index + 1} / ${item.preview.count}` : '-'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="absolute right-4 bottom-4 px-3 py-2 rounded-xl bg-black/60 border border-white/10">
|
||||
<p className="text-[10px] font-black text-white/70">
|
||||
MASK {item.preview?.maskPixels ? `${item.preview.maskPixels} px` : '无交集'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : viewerPreview?.imageUrl && !viewerError ? (
|
||||
<img src={`${API_BASE}${viewerPreview.imageUrl}`} className="w-full h-full object-contain" />
|
||||
|
||||
Reference in New Issue
Block a user