-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(globe): wait for layer to load before advancing timestep (#1268)
* feat(globe): store layer loading state in app-state * feat(globe): only advance time when layers have rendered * fix: add defaults for layerLoadingState
- Loading branch information
1 parent
30af60a
commit 6807f57
Showing
10 changed files
with
141 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {LayerLoadingState} from '@ubilabs/esa-webgl-globe'; | ||
|
||
export const UPDATE_LAYER_LOADING_STATE = 'UPDATE_LAYER_LOADING_STATE'; | ||
|
||
export interface UpdateLayerLoadingStateAction { | ||
type: typeof UPDATE_LAYER_LOADING_STATE; | ||
layerId: string; | ||
loadingState: LayerLoadingState; | ||
} | ||
|
||
export default function updateLayerLoadingStateAction( | ||
layerId: string, | ||
loadingState: LayerLoadingState | ||
): UpdateLayerLoadingStateAction { | ||
return {type: UPDATE_LAYER_LOADING_STATE, layerId, loadingState}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {LayerLoadingState} from '@ubilabs/esa-webgl-globe'; | ||
import { | ||
UPDATE_LAYER_LOADING_STATE, | ||
UpdateLayerLoadingStateAction | ||
} from '../../actions/update-layer-loading-state'; | ||
|
||
export type LoadingStateByLayer = {[layerId: string]: LayerLoadingState}; | ||
|
||
function layerLoadingStateReducer( | ||
state: LoadingStateByLayer = {}, | ||
action: UpdateLayerLoadingStateAction | ||
): LoadingStateByLayer { | ||
switch (action.type) { | ||
case UPDATE_LAYER_LOADING_STATE: | ||
return {...state, [action.layerId]: action.loadingState}; | ||
default: | ||
return state; | ||
} | ||
} | ||
|
||
export default layerLoadingStateReducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {State} from '../../reducers/index'; | ||
import {LoadingStateByLayer} from '../../reducers/globe/layer-loading-state'; | ||
|
||
export function layerLoadingStateSelector(state: State): LoadingStateByLayer { | ||
return state.globe.layerLoadingState; | ||
} |