Skip to content

Commit

Permalink
Fix: javascript error
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Jun 26, 2024
1 parent 5b5f9cf commit 550d8f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/store/reducers/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export const slice = createSlice({
},
setInitialViewBoxScale: (state, action) => {
state.initialViewBoxScale = action.payload;
state.initialViewBoxScaleForWidth = document.getElementById(ids.workspace).clientWidth;
state.initialViewBoxScaleForWidth = document.getElementById(ids.workspace)?.clientWidth;
},
setVisibilityOffset: (state, action) => {
state.visibilityOffset = action.payload;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getWorkspaceCenterY = () => {

export const getScaleFactorAccountingForViewBoxWidth = (scaleFactor: number, initialViewBoxScaleForWidth?: number) => {
if (initialViewBoxScaleForWidth) {
const currentWidth = document.getElementById(ids.workspace).clientWidth;
const currentWidth = document.getElementById(ids.workspace)?.clientWidth;
const ratio = currentWidth / initialViewBoxScaleForWidth;
scaleFactor *= ratio >= 1 ? ratio : ratio * 1.25;
}
Expand Down

0 comments on commit 550d8f4

Please sign in to comment.