diff --git a/src/scripts/components/main/data-viewer/data-viewer.tsx b/src/scripts/components/main/data-viewer/data-viewer.tsx index 1c87ff74a..0523bdb11 100644 --- a/src/scripts/components/main/data-viewer/data-viewer.tsx +++ b/src/scripts/components/main/data-viewer/data-viewer.tsx @@ -90,6 +90,13 @@ const DataViewer: FunctionComponent = ({ setCurrentView(globalGlobeView); }, [globalGlobeView]); + // stop globe spinning when layer is selected + useEffect(() => { + if ((mainId || compareId) && globeSpinning) { + dispatch(setGlobeSpinningAction(false)); + } + }, [dispatch, mainId, compareId, globeSpinning]); + // Only show the globe navigation when a globe is shown. // Either when no data layer is selected and only basemap is shown // or when one of the selected layers is a globe. Do not show globe navigation diff --git a/src/scripts/reducers/globe/spinning.ts b/src/scripts/reducers/globe/spinning.ts index 1ecbb48d4..d015fbd50 100644 --- a/src/scripts/reducers/globe/spinning.ts +++ b/src/scripts/reducers/globe/spinning.ts @@ -8,7 +8,6 @@ import { } from '../../actions/set-globe-projection'; import {SET_FLY_TO, SetFlyToAction} from '../../actions/set-fly-to'; -import {GlobeProjection} from '../../types/globe-projection'; import config from '../../config/main'; import {parseUrl} from '../../libs/globe-url-parameter'; @@ -24,7 +23,7 @@ function spinningReducer( case SET_GLOBE_SPINNING: return action.spinning; case SET_GLOBE_PROJECTION: - return action.projection === GlobeProjection.Sphere; + return false; case SET_FLY_TO: return false; default: