Adding a check to reevaluate the map if min/max zoom levels are different in choosen tile servers.

This commit is contained in:
Eric van der Vlist 2022-09-27 18:03:43 +02:00
parent 59fbe4aa3f
commit d71881dc02
1 changed files with 6 additions and 0 deletions

View File

@ -212,6 +212,12 @@ const mapSlice = createSlice({
reducers: { reducers: {
setTileProvider: (state, action) => { setTileProvider: (state, action) => {
state.scope.tileProvider = action.payload; state.scope.tileProvider = action.payload;
if (
state.tiles.zoom < tileProviders[state.scope.tileProvider].minZoom ||
state.tiles.zoom > tileProviders[state.scope.tileProvider].maxZoom
) {
evaluateStateFromScope(state);
}
}, },
resize: (state) => { resize: (state) => {
evaluateStateFromScope(state); evaluateStateFromScope(state);