Updaters for mapState reducer. Can be used in your root reducer to directly modify kepler.gl's state.
Read more about Using updaters
Examples
import keplerGlReducer, {mapStateUpdaters} from 'kepler.gl/reducers';
// Root Reducer
const reducers = combineReducers({
keplerGl: keplerGlReducer,
app: appReducer
});
const composedReducer = (state, action) => {
switch (action.type) {
// click button to close side panel
case 'CLICK_BUTTON':
return {
...state,
keplerGl: {
...state.keplerGl,
foo: {
...state.keplerGl.foo,
mapState: mapStateUpdaters.fitBoundsUpdater(
mapState, {payload: [127.34, 31.09, 127.56, 31.59]]}
)
}
}
};
}
return reducers(state, action);
};
export default composedReducer;Fit map viewport to bounds
- Action:
fitBounds
Parameters
Returns Object nextState
Default initial mapState
pitchnumber Default:0bearingnumber Default:0latitudenumber Default:37.75043longitudenumber Default:-122.34679zoomnumber Default:9dragRotateboolean Default:falsewidthnumber Default:800heightnumber Default:800isSplitboolean Default:false
Update mapState to propagate a new config
- Action:
receiveMapConfig
Parameters
stateObjectactionObjectaction.payloadObject saved map configaction.payload.config(optional, default{})action.payload.options(optional, default{})action.payload.bounds(optional, defaultnull)
Returns Object nextState
reset mapState to initial State
- Action:
resetMapConfig
Parameters
stateObjectmapState
Returns Object nextState
Toggle between 3d and 2d map.
- Action:
togglePerspective
Parameters
stateObject
Returns Object nextState
Toggle between one or split maps
- Action:
toggleSplitMap
Parameters
stateObject
Returns Object nextState
Update map viewport
- Action:
updateMap
Parameters
Returns Object nextState