Skip to content

Commit

Permalink
fix: stop ditching viewport on reset, therefore stop reloading the page
Browse files Browse the repository at this point in the history
  • Loading branch information
matyson committed Mar 28, 2024
1 parent 17582b8 commit 38e13b7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/pianno/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ export const createStore = (initialState: State = defaultState) =>
viewport?.fit(true, width, height);
},
reset: () => {
set(initialState);
// force reload to reset viewport
window.location.reload();
set({
brush: initialState.brush,
colors: initialState.colors,
currentColor: initialState.currentColor,
img: initialState.img,
imgMetadata: initialState.imgMetadata,
label: initialState.label,
});
},
setBrushMode: (mode) => {
const brush = get().brush;
Expand Down

0 comments on commit 38e13b7

Please sign in to comment.