Revize 7b864a5c
Přidáno uživatelem Václav Honzík před asi 2 roky(ů)
frontend/src/features/TrackingTool/trackingToolSlice.ts | ||
---|---|---|
3 | 3 |
import { persistReducer } from "redux-persist" |
4 | 4 |
import mapConfig from "../../config/mapConfig" |
5 | 5 |
import { PathDto } from "../../swagger/data-contracts" |
6 |
import buildPathVariants, { PathVariant } from "./buildPathVariants" |
|
6 |
import buildPathVariants, { MapPoint, PathVariant } from "./buildPathVariants"
|
|
7 | 7 |
import { sendTextForProcessing } from "./trackingToolThunks" |
8 | 8 |
import storage from "redux-persist/lib/storage" |
9 | 9 |
|
... | ... | |
66 | 66 |
...state, |
67 | 67 |
currentPage: action.payload, |
68 | 68 |
}), |
69 |
updateMapMarkerPosition: (state: TrackingToolState, action: any) => {
|
|
70 |
const { idx, mapPointIdx, position } = action.payload
|
|
69 |
updateMapMarker: (state: TrackingToolState, action: { payload: { idx: number, item: MapPoint } }) => {
|
|
70 |
const { idx, item } = action.payload
|
|
71 | 71 |
if (!state.pathVariants || state.pathVariants.length <= idx) { |
72 | 72 |
return state |
73 | 73 |
} |
... | ... | |
79 | 79 |
return [...pathVariant] |
80 | 80 |
} |
81 | 81 |
|
82 |
const mapPoint = pathVariant[mapPointIdx] |
|
83 |
mapPoint.catalogItem = { |
|
84 |
...mapPoint.catalogItem, |
|
85 |
latitude: position[0], |
|
86 |
longitude: position[1] |
|
87 |
} |
|
88 |
|
|
89 | 82 |
return [ |
90 |
...pathVariant.slice(0, mapPointIdx),
|
|
91 |
mapPoint,
|
|
92 |
...pathVariant.slice(mapPointIdx + 1),
|
|
83 |
...pathVariant.slice(0, item.idx),
|
|
84 |
item,
|
|
85 |
...pathVariant.slice(item.idx + 1),
|
|
93 | 86 |
] |
94 | 87 |
}) |
95 | 88 |
} |
... | ... | |
131 | 124 |
}, |
132 | 125 |
}) |
133 | 126 |
|
134 |
export const { consumeErr, setPrimaryIdx, resetDialogApiCallSuccess, clear, updateMapMarkerPosition } =
|
|
127 |
export const { consumeErr, setPrimaryIdx, resetDialogApiCallSuccess, clear, updateMapMarker } = |
|
135 | 128 |
trackingToolSlice.actions |
136 | 129 |
const trackingToolReducer = trackingToolSlice.reducer |
137 | 130 |
export default trackingToolReducer |
Také k dispozici: Unified diff
path dragging and adjustment seems functional