Merge branch 'master' of github.com:ornicar/lila into prettier
* 'master' of github.com:ornicar/lila: storm button hotkeyspull/7944/head
commit
63ddf105a1
|
@ -41,12 +41,14 @@ export default class StormCtrl {
|
|||
};
|
||||
this.promotion = makePromotion(this.withGround, this.makeCgOpts, redraw);
|
||||
this.checkDupTab();
|
||||
setTimeout(this.hotkeys, 1000);
|
||||
}
|
||||
|
||||
clockMillis = (): number | undefined =>
|
||||
this.vm.run.startAt && Math.max(0, this.vm.run.startAt + this.vm.clock - getNow());
|
||||
|
||||
end = (): void => {
|
||||
if (!this.vm.puzzleStartAt) return;
|
||||
this.vm.history.reverse();
|
||||
this.vm.run.endAt = getNow();
|
||||
this.ground(false);
|
||||
|
@ -244,4 +246,11 @@ export default class StormCtrl {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private hotkeys = () => {
|
||||
window.Mousetrap
|
||||
.bind('space', () => location.reload())
|
||||
.bind('return', this.end);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,17 +49,15 @@ const renderControls = (ctrl: StormCtrl): VNode =>
|
|||
attrs: {
|
||||
href: '/storm',
|
||||
'data-icon': 'B',
|
||||
title: 'New run'
|
||||
title: 'New run (hotkey: Space)'
|
||||
}
|
||||
}),
|
||||
h('a.storm__control__end.button.button-empty', {
|
||||
attrs: {
|
||||
'data-icon': 'b',
|
||||
title: 'End run',
|
||||
title: 'End run (hotkey: Enter)',
|
||||
},
|
||||
hook: onInsert(el => el.addEventListener('click', () => {
|
||||
if (ctrl.vm.puzzleStartAt) ctrl.end()
|
||||
}))
|
||||
hook: onInsert(el => el.addEventListener('click', ctrl.end))
|
||||
})
|
||||
]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue