Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -418,8 +418,11 @@ export const useModelStore = create<ModelStore>((set, get) => ({
|
|||||||
|
|
||||||
fineTuning: { ...defaultFineTuning },
|
fineTuning: { ...defaultFineTuning },
|
||||||
setFineTuning: (ft) => set((state) => {
|
setFineTuning: (ft) => set((state) => {
|
||||||
const newFT = { ...state.fineTuning, ...ft };
|
|
||||||
const activeId = state.activeModelId;
|
const activeId = state.activeModelId;
|
||||||
|
const activeBefore = state.models.find(m => m.id === activeId);
|
||||||
|
// Lock guard: when the active model is locked, ignore any movement/scale change.
|
||||||
|
if (activeBefore?.locked) return {};
|
||||||
|
const newFT = { ...state.fineTuning, ...ft };
|
||||||
const models = activeId
|
const models = activeId
|
||||||
? state.models.map(m => m.id === activeId ? { ...m, fineTuning: newFT } : m)
|
? state.models.map(m => m.id === activeId ? { ...m, fineTuning: newFT } : m)
|
||||||
: state.models;
|
: state.models;
|
||||||
@@ -429,8 +432,10 @@ export const useModelStore = create<ModelStore>((set, get) => ({
|
|||||||
return { fineTuning: newFT, models };
|
return { fineTuning: newFT, models };
|
||||||
}),
|
}),
|
||||||
resetFineTuning: () => set((state) => {
|
resetFineTuning: () => set((state) => {
|
||||||
const reset = { ...defaultFineTuning };
|
|
||||||
const activeId = state.activeModelId;
|
const activeId = state.activeModelId;
|
||||||
|
const activeBefore = state.models.find(m => m.id === activeId);
|
||||||
|
if (activeBefore?.locked) return {};
|
||||||
|
const reset = { ...defaultFineTuning };
|
||||||
const models = activeId
|
const models = activeId
|
||||||
? state.models.map(m => m.id === activeId ? { ...m, fineTuning: reset } : m)
|
? state.models.map(m => m.id === activeId ? { ...m, fineTuning: reset } : m)
|
||||||
: state.models;
|
: state.models;
|
||||||
@@ -449,11 +454,17 @@ export const useModelStore = create<ModelStore>((set, get) => ({
|
|||||||
setXrSupported: (xrSupported) => set({ xrSupported }),
|
setXrSupported: (xrSupported) => set({ xrSupported }),
|
||||||
|
|
||||||
scaleRatio: SCALE_PRESETS.find(p => p.label === '1:1')!,
|
scaleRatio: SCALE_PRESETS.find(p => p.label === '1:1')!,
|
||||||
setScaleRatio: (scaleRatio) => set({ scaleRatio }),
|
setScaleRatio: (scaleRatio) => set((state) => {
|
||||||
|
const activeBefore = state.models.find(m => m.id === state.activeModelId);
|
||||||
|
if (activeBefore?.locked) return {};
|
||||||
|
return { scaleRatio };
|
||||||
|
}),
|
||||||
scaleResetNonce: 0,
|
scaleResetNonce: 0,
|
||||||
resetScale: () => set((state) => {
|
resetScale: () => set((state) => {
|
||||||
const oneToOne = SCALE_PRESETS.find(p => p.label === '1:1')!;
|
|
||||||
const activeId = state.activeModelId;
|
const activeId = state.activeModelId;
|
||||||
|
const activeBefore = state.models.find(m => m.id === activeId);
|
||||||
|
if (activeBefore?.locked) return {};
|
||||||
|
const oneToOne = SCALE_PRESETS.find(p => p.label === '1:1')!;
|
||||||
const models = activeId
|
const models = activeId
|
||||||
? state.models.map(m => m.id === activeId
|
? state.models.map(m => m.id === activeId
|
||||||
? { ...m, fineTuning: { ...m.fineTuning, scale: 1 } }
|
? { ...m, fineTuning: { ...m.fineTuning, scale: 1 } }
|
||||||
|
|||||||
Reference in New Issue
Block a user