mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
redux: trashing fixed
This commit is contained in:
parent
eb5b0e5d28
commit
2171a50ef1
7 changed files with 109 additions and 70 deletions
|
@ -19,3 +19,8 @@ export const stopEditing = () => ({ type: ACTIONS.STOP_EDITING });
|
|||
|
||||
export const routerCancel = () => ({ type: ACTIONS.ROUTER_CANCEL });
|
||||
export const routerSubmit = () => ({ type: ACTIONS.ROUTER_SUBMIT });
|
||||
|
||||
export const clearPoly = () => ({ type: ACTIONS.CLEAR_POLY });
|
||||
export const clearStickers = () => ({ type: ACTIONS.CLEAR_STICKERS });
|
||||
export const clearAll = () => ({ type: ACTIONS.CLEAR_ALL });
|
||||
export const clearCancel = () => ({ type: ACTIONS.CLEAR_CANCEL });
|
||||
|
|
|
@ -17,4 +17,9 @@ export const ACTIONS = {
|
|||
|
||||
ROUTER_CANCEL: 'ROUTER_CANCEL',
|
||||
ROUTER_SUBMIT: 'ROUTER_SUBMIT',
|
||||
|
||||
CLEAR_POLY: 'CLEAR_POLY',
|
||||
CLEAR_STICKERS: 'CLEAR_STICKERS',
|
||||
CLEAR_ALL: 'CLEAR_ALL',
|
||||
CLEAR_CANCEL: 'CLEAR_CANCEL',
|
||||
};
|
||||
|
|
|
@ -141,6 +141,27 @@ function* routerSubmitSaga() {
|
|||
return true;
|
||||
}
|
||||
|
||||
function* clearSaga({ type }){
|
||||
switch (type) {
|
||||
case ACTIONS.CLEAR_POLY:
|
||||
editor.poly.clearAll();
|
||||
editor.router.clearAll();
|
||||
break;
|
||||
|
||||
case ACTIONS.CLEAR_STICKERS:
|
||||
editor.stickers.clearAll();
|
||||
break;
|
||||
|
||||
case ACTIONS.CLEAR_ALL:
|
||||
editor.clearAll();
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
yield put(setMode(MODES.NONE));
|
||||
}
|
||||
|
||||
export function* userSaga() {
|
||||
// ASYNCHRONOUS!!! :-)
|
||||
|
||||
|
@ -156,4 +177,11 @@ export function* userSaga() {
|
|||
|
||||
yield takeEvery(ACTIONS.ROUTER_CANCEL, routerCancelSaga);
|
||||
yield takeEvery(ACTIONS.ROUTER_SUBMIT, routerSubmitSaga);
|
||||
yield takeEvery([
|
||||
ACTIONS.CLEAR_POLY,
|
||||
ACTIONS.CLEAR_STICKERS,
|
||||
ACTIONS.CLEAR_ALL,
|
||||
ACTIONS.CLEAR_CANCEL,
|
||||
], clearSaga);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue