From 69ab53aae4b8e096bd7d3eaf3c9a1e48fbd74d2f Mon Sep 17 00:00:00 2001 From: Nils Christian Bonnevie Date: Tue, 3 Oct 2023 12:29:34 +0200 Subject: [PATCH] fix: "IsRenderedCallack" shold return true for layers which has visible attribute set to false. --- .../subsurface-viewer/src/components/Map.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/typescript/packages/subsurface-viewer/src/components/Map.tsx b/typescript/packages/subsurface-viewer/src/components/Map.tsx index b7577464b..1769ebb2b 100644 --- a/typescript/packages/subsurface-viewer/src/components/Map.tsx +++ b/typescript/packages/subsurface-viewer/src/components/Map.tsx @@ -578,7 +578,7 @@ const Map: React.FC = ({ getTooltip = defaultTooltip, cameraPosition, getCameraPosition, - isRenderedCallback: isLoadedCallback, + isRenderedCallback, onDragStart, onDragEnd, triggerHome, @@ -919,7 +919,9 @@ const Map: React.FC = ({ const onAfterRender = useCallback(() => { if (deckGLLayers) { const loadedState = deckGLLayers.every((layer) => { - return (layer as Layer).isLoaded; + return ( + (layer as Layer).isLoaded || !(layer as Layer).props.visible + ); }); const emptyLayers = // There will always be a dummy layer. Deck.gl does not like empty array of layers. @@ -928,11 +930,11 @@ const Map: React.FC = ({ "webviz_internal_dummy_layer"; setIsLoaded(loadedState || emptyLayers); - if (typeof isLoadedCallback !== "undefined") { - isLoadedCallback(loadedState); + if (typeof isRenderedCallback !== "undefined") { + isRenderedCallback(loadedState); } } - }, [deckGLLayers, isLoadedCallback]); + }, [deckGLLayers, isRenderedCallback]); // validate layers data const [errorText, setErrorText] = useState();