blob: b6a071f6f2a7a4132ce999b66e5517b429e3350d (
plain) (
blame)
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
|
import actions from 'content/actions';
const defaultState = {
set: false,
jump: false,
marks: {},
};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.MARK_START_SET:
return { ...state, set: true };
case actions.MARK_START_JUMP:
return { ...state, jump: true };
case actions.MARK_CANCEL:
return { ...state, set: false, jump: false };
case actions.MARK_SET_LOCAL: {
let marks = { ...state.marks };
marks[action.key] = { y: action.y };
return { ...state, marks };
}
default:
return state;
}
}
|