You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1000 B
46 lines
1000 B
import * as OptionsActions from '../../actions/options/options.actions';
|
|
import ModeCtrl from '../mode.controller';
|
|
|
|
let dispatch;
|
|
const values = ['Multiples', 'Factors', 'Addition', 'Subtraction'];
|
|
let selected = 0;
|
|
|
|
const OptionsCtrl = {
|
|
setDispatch: d => dispatch = d,
|
|
|
|
getValues: () => values,
|
|
|
|
update() {
|
|
dispatch(OptionsActions.update(selected));
|
|
},
|
|
|
|
keyListener(e) {
|
|
if (e.keyCode === 32) {
|
|
let model =
|
|
// switch (selected) {
|
|
// case 0:
|
|
// }
|
|
ModeCtrl.board();
|
|
}
|
|
else if (e.keyCode === 38) {
|
|
selected--;
|
|
|
|
if (selected === -1) {
|
|
selected = values.length - 1;
|
|
}
|
|
|
|
this.update();
|
|
}
|
|
else if (e.keyCode === 40) {
|
|
selected++;
|
|
|
|
if (selected === values.length) {
|
|
selected = 0;
|
|
}
|
|
|
|
this.update();
|
|
}
|
|
}
|
|
};
|
|
|
|
export default OptionsCtrl;
|
|
|