fix(scale): fix

This commit is contained in:
zhangheng
2026-04-21 15:49:41 +08:00
parent 853801b947
commit d7b2195078
6 changed files with 276 additions and 24 deletions

View File

@@ -62,6 +62,8 @@ interface TopToolsState {
setSaveCurrentScale: (val: boolean) => void
scale: number
setScale: (val: number) => void
displayedScale: number
setDisplayedScale: (val: number) => void
activeOperation: string
setActiveOperation: (val: string) => void
showObjectList: boolean
@@ -114,6 +116,7 @@ const initialTopToolsState = {
drawOption: "default" as "default" | "intersect" | "unite",
saveCurrentScale: false,
scale: 1,
displayedScale: 1,
activeOperation: "",
showObjectList: false,
showGroupList: false,
@@ -248,6 +251,12 @@ export const useTopToolsStore = create<TopToolsState>()(
...state,
scale: val,
})),
displayedScale: initialTopToolsState.displayedScale,
setDisplayedScale: (val: number) =>
set((state: TopToolsState) => ({
...state,
displayedScale: Number.isFinite(val) && val > 0 ? val : 1,
})),
activeOperation: initialTopToolsState.activeOperation,
setActiveOperation: (val: string) =>
set((state: TopToolsState) => ({