keep brush size when switch images

This commit is contained in:
Qing
2023-02-19 14:40:38 +08:00
parent 774f470e58
commit 1a865810f5
2 changed files with 19 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ interface AppState {
showFileManager: boolean
enableFileManager: boolean
gifImage: HTMLImageElement | undefined
brushSize: number
}
export const appState = atom<AppState>({
@@ -66,6 +67,7 @@ export const appState = atom<AppState>({
showFileManager: false,
enableFileManager: false,
gifImage: undefined,
brushSize: 40,
},
})
@@ -91,6 +93,18 @@ export const isInpaintingState = selector({
},
})
export const brushSizeState = selector({
key: 'brushSizeState',
get: ({ get }) => {
const app = get(appState)
return app.brushSize
},
set: ({ get, set }, newValue: any) => {
const app = get(appState)
set(appState, { ...app, brushSize: newValue })
},
})
export const imageHeightState = selector({
key: 'imageHeightState',
get: ({ get }) => {