Attempt to create a new, more react friendly slippy map library.
This commit is contained in:
1 parent
a154a5aa44
commit
9e8aec244e
16 files changed
+3899
-505
No files matched your search
@@ -1,31 +0,0 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState: any = {
|
||||
current: {
|
||||
$: {},
|
||||
trk: [
|
||||
{
|
||||
trkseg: [{ trkpt: [] }],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const slice = createSlice({
|
||||
name: 'gpx',
|
||||
initialState: initialState,
|
||||
reducers: {
|
||||
appendTrkpt(state, action) {
|
||||
state[action.payload.trkKey].trk[0].trkseg[0].trkpt.push(
|
||||
action.payload.trkpt
|
||||
);
|
||||
},
|
||||
clearGPX(state, action) {
|
||||
state[action.payload.trkKey] = initialState.current;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const gpxActions = slice.actions;
|
||||
|
||||
export default slice.reducer;
|
||||
@@ -1,9 +0,0 @@
|
||||
import { configureStore } from '@reduxjs/toolkit';
|
||||
|
||||
import gpxReducer from './gpx';
|
||||
|
||||
const store = configureStore({
|
||||
reducer: { gpx: gpxReducer },
|
||||
});
|
||||
|
||||
export default store;
|
||||
Reference in new issue
Block a user