Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 40e45314

Přidáno uživatelem Václav Honzík před asi 2 roky(ů)

reidxing + drag jump fix

Zobrazit rozdíly:

frontend/src/features/TrackingTool/trackingToolSlice.ts
81 81
            }
82 82
        },
83 83
        // Updates map marker based on its idx property
84
        updateMapMarker: (state: TrackingToolState, action: { payload: { item: MapPoint } }) => {
85
            const { item } = action.payload
84
        updateMapMarker: (state: TrackingToolState, action: { payload: MapPoint }) => {
85
            const item = action.payload
86 86
            const idx = state.primaryPathIdx
87 87
            if (!state.pathVariants || state.pathVariants.length <= idx) {
88 88
                return state
......
103 103
                })
104 104
            }
105 105
        },
106
        swapMapMarkerIndices: (state: TrackingToolState, action: { payload: { destination: number, source: number } }) => {
106
        moveMarkerToDestination: (state: TrackingToolState, action: { payload: { destination: number, source: number } }) => {
107 107
            const { destination, source } = action.payload
108 108
            if (!state.pathVariants || state.pathVariants.length === 0) {
109 109
                return state
......
124 124
                    const result = [...pathVariant]
125 125
                    const [removed] = result.splice(source, 1)
126 126
                    result.splice(destination, 0, removed)
127
                    return result
127
                    return result.map((item, idx) => ({ ...item, idx }))
128 128
                })
129 129
            }
130 130
        },
......
230 230
    clear,
231 231
    updateMapMarker,
232 232
    mergeWithCurrentPath,
233
    swapMapMarkerIndices,
233
    moveMarkerToDestination,
234 234
    updateMapMarkerWithId
235 235
} = trackingToolSlice.actions
236 236
const trackingToolReducer = trackingToolSlice.reducer

Také k dispozici: Unified diff