preserve cutoff line color in rotated preview

This commit is contained in:
2026-05-03 02:29:17 +08:00
parent a937583400
commit d46f320a74
2 changed files with 14 additions and 3 deletions

View File

@@ -86,9 +86,11 @@ type LibraryInfo = {
type StoredDeformationJob = {
job: BackendJob;
progress: number;
renderVersion?: string;
};
const DEFORMATION_JOB_STORAGE_KEY = 'head_ct_morph_deformation_job';
const DEFORMATION_RESULT_RENDER_VERSION = 'quick-preview-cutoff-only-v1';
const API_BASE = typeof window === 'undefined'
? 'http://127.0.0.1:8787'
@@ -109,6 +111,10 @@ function readStoredDeformationJob(): StoredDeformationJob | null {
if (!rawValue) return null;
const parsed = JSON.parse(rawValue) as StoredDeformationJob;
if (!parsed?.job?.id) return null;
if (parsed.renderVersion !== DEFORMATION_RESULT_RENDER_VERSION) {
window.localStorage.removeItem(DEFORMATION_JOB_STORAGE_KEY);
return null;
}
return {
job: parsed.job,
progress: Math.max(0, Math.min(100, parsed.progress || 0)),
@@ -417,6 +423,7 @@ export default function App() {
JSON.stringify({
job: deformationJob,
progress: deformationJob.status === 'completed' ? 100 : progress,
renderVersion: DEFORMATION_RESULT_RENDER_VERSION,
})
);
}, [deformationJob, progress]);