Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(spinning-globe): stop when layer is selected or projection changes #683

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/scripts/components/main/data-viewer/data-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ const DataViewer: FunctionComponent<Props> = ({
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
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/reducers/globe/spinning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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:
Expand Down