diff --git a/src/stores/useModelStore.ts b/src/stores/useModelStore.ts index b34919e..8fb4c1a 100644 --- a/src/stores/useModelStore.ts +++ b/src/stores/useModelStore.ts @@ -379,6 +379,25 @@ export const useModelStore = create((set, get) => ({ scaleRatio: SCALE_PRESETS.find(p => p.label === '1:1')!, setScaleRatio: (scaleRatio) => set({ scaleRatio }), + scaleResetNonce: 0, + resetScale: () => set((state) => { + const oneToOne = SCALE_PRESETS.find(p => p.label === '1:1')!; + const activeId = state.activeModelId; + const models = activeId + ? state.models.map(m => m.id === activeId + ? { ...m, fineTuning: { ...m.fineTuning, scale: 1 } } + : m) + : state.models; + const active = models.find(m => m.id === activeId); + const fineTuning = active ? { ...active.fineTuning } : { ...state.fineTuning, scale: 1 }; + if (active) savePlacement(active.fileName, fineTuning); + return { + scaleRatio: oneToOne, + models, + fineTuning, + scaleResetNonce: state.scaleResetNonce + 1, + }; + }), opacity: 1, setOpacity: (opacity) => set({ opacity }),