From 3df20bbcee9afe31c108b168c265e6a7ac9552be Mon Sep 17 00:00:00 2001 From: Havard Bjerke Date: Tue, 17 Sep 2024 09:28:09 +0200 Subject: [PATCH] fix: allow initializing scaling factor value --- typescript/packages/subsurface-viewer/src/utils/event.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typescript/packages/subsurface-viewer/src/utils/event.ts b/typescript/packages/subsurface-viewer/src/utils/event.ts index e3f925c66..a9a11c087 100644 --- a/typescript/packages/subsurface-viewer/src/utils/event.ts +++ b/typescript/packages/subsurface-viewer/src/utils/event.ts @@ -58,8 +58,8 @@ function convertToArrowEvent(event: KeyboardEvent): ArrowEvent | null { * the state, and a ref that is used to attach the event listener used for * keyboard events. */ -export const useScaleFactor = () => { - const [factor, setFactor] = React.useState(1); +export const useScaleFactor = (initialValue?: number) => { + const [factor, setFactor] = React.useState(initialValue ?? 1); const elementRef = React.useRef(null);