fix(top): fix

This commit is contained in:
2026-03-19 18:03:41 +08:00
parent a6c83ef3f6
commit de91f1c9d8
4 changed files with 233 additions and 141 deletions

View File

@@ -4,6 +4,7 @@ import { persist } from "zustand/middleware"
import { usePaperStore } from "./usePaperStore"
import { useObjectStore } from "./store"
import { useBottomToolsStore } from "./useBottomToolsStore"
import { safeClone } from "./utils/clone"
interface TopToolsState {
// 标注页面是否仅查看
@@ -59,10 +60,13 @@ interface TopToolsState {
subAttributes: {
// key: label_class
[key: string]: {
[key: string]: string
[key: string]: string | string[]
}
}
setsubAttributes: (key: string, val: { [key: string]: string }) => void
setsubAttributes: (
key: string,
val: { [key: string]: string | string[] }
) => void
objectOperations: Project.LabelSchemaList[]
setObjectOperations: (val: Project.LabelSchemaList[]) => void
needBackup: boolean
@@ -219,10 +223,10 @@ export const useTopToolsStore = create<TopToolsState>()(
setsubAttributes: (key, val) =>
set((state: TopToolsState) => ({
...state,
subAttributes: Object.assign(
useTopToolsStore.getState().subAttributes,
{ [key]: val }
),
subAttributes: {
...state.subAttributes,
[key]: safeClone(val),
},
})),
objectOperations: initialTopToolsState.objectOperations,
setObjectOperations: (val) =>