fix: preserve model selection when toggling series
This commit is contained in:
@@ -171,10 +171,7 @@ export default function VehicleTree({ selection, onSelect }: Props) {
|
||||
<div
|
||||
className={`flex items-center gap-1 px-1 py-1 rounded cursor-pointer group text-xs
|
||||
${isSeriesSelected ? 'bg-primary/20 text-primary' : 'hover:bg-secondary/60'}`}
|
||||
onClick={() => {
|
||||
toggleSeries(series.id);
|
||||
onSelect({ seriesId: series.id, modelId: null, taskId: null });
|
||||
}}
|
||||
onClick={() => toggleSeries(series.id)}
|
||||
>
|
||||
{expanded ? <ChevronDown className="w-3 h-3 flex-shrink-0 text-muted-foreground" /> : <ChevronRight className="w-3 h-3 flex-shrink-0 text-muted-foreground" />}
|
||||
<Train className="w-3 h-3 flex-shrink-0 text-muted-foreground" />
|
||||
|
||||
@@ -278,24 +278,23 @@ export default function Home() {
|
||||
|
||||
// ── 左侧面板渲染 ───────────────────────────────────────────────────────────
|
||||
const renderLeftPanel = () => {
|
||||
if (selection.modelId == null) {
|
||||
return (
|
||||
<VehicleTree selection={selection} onSelect={setSelection} />
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="flex min-h-0 flex-1 flex-col">
|
||||
<VehicleTree selection={selection} onSelect={setSelection} />
|
||||
<div className="h-px bg-border my-1" />
|
||||
<TaskManager
|
||||
modelId={selection.modelId}
|
||||
activeTaskId={selection.taskId}
|
||||
onSelectTask={taskId => setSelection(s => ({ ...s, taskId }))}
|
||||
onLoadPointClouds={handleLoadPointClouds}
|
||||
onPcFilesSelectionChange={setSelectedPcFileIds}
|
||||
onCadFilesSelectionChange={setSelectedTaskCadFileIds}
|
||||
onSelectTaskCad={handleSelectCad}
|
||||
/>
|
||||
{selection.modelId != null && (
|
||||
<>
|
||||
<div className="h-px bg-border my-1" />
|
||||
<TaskManager
|
||||
modelId={selection.modelId}
|
||||
activeTaskId={selection.taskId}
|
||||
onSelectTask={taskId => setSelection(s => ({ ...s, taskId }))}
|
||||
onLoadPointClouds={handleLoadPointClouds}
|
||||
onPcFilesSelectionChange={setSelectedPcFileIds}
|
||||
onCadFilesSelectionChange={setSelectedTaskCadFileIds}
|
||||
onSelectTaskCad={handleSelectCad}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user