Skip to content

Commit

Permalink
fix returning invalid scale and xy values
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloose committed Nov 22, 2024
1 parent 0d714eb commit c5df761
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/pages/Editor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const saveXYToLocalStorage = debounce((x: number, y: number) => {

export const getInitialScale = () => {
const s = Number(localStorage.getItem('editor_scale'));
if (Number.isNaN(s)) {
if (!s || Number.isNaN(s)) {
return 1;
}
return s;
Expand All @@ -55,7 +55,7 @@ export const getInitialScale = () => {
export const getInitialXY = () => {
const x = Number(localStorage.getItem('editor_x'));
const y = Number(localStorage.getItem('editor_y'));
if (!Number.isNaN(x) && !Number.isNaN(y)) {
if ((x != 0 && y!= 0) && !Number.isNaN(x) && !Number.isNaN(y)) {
return { x, y };
}
return { x: null, y: null };
Expand Down

0 comments on commit c5df761

Please sign in to comment.