-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathtreeToo.js
57 lines (55 loc) · 1.92 KB
/
treeToo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import * as types from "../actions/types";
import { getDefaultTreeState } from "./tree";
/* A version increase (i.e. props.version !== nextProps.version) necessarily implies
that the tree is loaded as they are set on the same action */
const treeToo = (state = getDefaultTreeState(), action) => {
switch (action.type) {
// case types.URL_QUERY_CHANGE_WITH_COMPUTED_STATE: /* fallthrough */
// case types.CLEAN_START:
// return action.tree;
case types.DATA_INVALID:
return Object.assign({}, state, {
loaded: false
});
case types.REMOVE_TREE_TOO:
return getDefaultTreeState();
case types.CLEAN_START:
if (action.treeToo) {
return action.treeToo;
}
return state;
case types.TREE_TOO_DATA:
return action.treeToo;
case types.CHANGE_DATES_VISIBILITY_THICKNESS: /* fall-through */
case types.UPDATE_VISIBILITY_AND_BRANCH_THICKNESS:
if (action.tangleTipLookup) {
// console.warn("NB missing visibleStateCounts from treeToo here");
return Object.assign({}, state, {
tangleTipLookup: action.tangleTipLookup,
visibility: action.visibilityToo,
visibilityVersion: action.visibilityVersionToo,
branchThickness: action.branchThicknessToo,
branchThicknessVersion: action.branchThicknessVersionToo,
idxOfInViewRootNode: action.idxOfInViewRootNodeToo,
selectedStrain: action.selectedStrain
});
}
return state;
case types.UPDATE_TIP_RADII:
return Object.assign({}, state, {
tipRadii: action.dataToo,
tipRadiiVersion: action.version
});
case types.NEW_COLORS:
if (action.nodeColorsToo) {
return Object.assign({}, state, {
nodeColors: action.nodeColorsToo,
nodeColorsVersion: action.nodeColorsVersion
});
}
return state;
default:
return state;
}
};
export default treeToo;