simplify clear

This commit is contained in:
casperlamboo 2017-11-14 18:43:30 +01:00
parent 026c6f4ac3
commit e6cda7fbdb
4 changed files with 3 additions and 24 deletions

View File

@ -10,11 +10,6 @@ export default function pinchZoomReducer(state, action) {
if (action.log !== false) debug(action.type);
switch (action.type) {
case actions.CLEAR:
return update(state, {
d2: { canvasMatrix: { $set: new Matrix() } }
});
case actions.D2_MULTITOUCH:
return multitouch(state, action);

View File

@ -91,9 +91,6 @@ export function cameraReducer(state, action) {
return pan(state, panDelta);
}
case actions.CLEAR:
return defaultCamera;
default:
return state;
}

View File

@ -207,15 +207,10 @@ function sketcherReducer(state = initialState, action) {
state = updateMenus(state, action);
return state;
// actions.user.USER_LOGOUT_FULFILLED
// actions.files.FILES_LOAD_FULFILLED:
case actions.CLEAR:
state = setActive2D(state, null);
state = removeAllObjects(state);
state = selectionReducer(state, action); // deselect all
state = d2PinchZoomReducer(state, action); // reset zoom
state = update(state, {
d3: { camera: { $set: cameraReducer(state.d3.camera, action) } }
});
return state;
return initialState;
case actions.DUPLICATE_SELECTION:
case actions.DELETE_SELECTION:
@ -232,13 +227,6 @@ function sketcherReducer(state = initialState, action) {
objectsById: { [action.id]: { transform: { $set: action.transform } } }
});
// TODO these actions should reset
// actions.user.USER_LOGOUT_FULFILLED
// actions.files.OPEN_SKETCH:
// actions.files.FILES_LOAD_FULFILLED:
case actions.CLEAR:
return initialState;
default:
return state;
}

View File

@ -35,7 +35,6 @@ export default function selectionReducer(state, action) {
case actions.D2_CHANGE_TOOL:
case actions.DESELECT_ALL:
case actions.CLEAR:
return deselectAll(state);
case actions.DRAG_SELECT: