From 77ea3554c634e03c052e7d410758e649558b37ec Mon Sep 17 00:00:00 2001 From: nilscb Date: Mon, 11 Sep 2023 08:35:02 +0200 Subject: [PATCH] fix, patch: Prevent possible Nan values if viewport has zero width and/or height (#1652) - happens rarely but has been observed. Unknown reason. --- typescript/packages/subsurface-viewer/src/components/Map.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/packages/subsurface-viewer/src/components/Map.tsx b/typescript/packages/subsurface-viewer/src/components/Map.tsx index aeafe5978..e99b800a3 100644 --- a/typescript/packages/subsurface-viewer/src/components/Map.tsx +++ b/typescript/packages/subsurface-viewer/src/components/Map.tsx @@ -1163,7 +1163,7 @@ function getViewState( let fb_target = [fb.x, fb.y, z]; let fb_zoom = fb.zoom; - if (deck) { + if (deck && deck.width > 0 && deck.height > 0) { // If there are margins/rulers in the viewport (axes2DLayer) we have to account for that. // Camera target should be in the middle of viewport minus the rulers. const w_bounds = w;