Initial keybinding functionality + documentation

Todo:
- allow user to specify whether to use alt or meta key (relatively easy to implement)
- keybinding icon for about pane
This commit is contained in:
Matt C 2017-10-17 19:36:51 +01:00
parent bd1790b692
commit 638e03856b
3 changed files with 222 additions and 24 deletions

View file

@ -8,6 +8,7 @@ import OutputWaiter from "./OutputWaiter.js";
import OptionsWaiter from "./OptionsWaiter.js";
import HighlighterWaiter from "./HighlighterWaiter.js";
import SeasonalWaiter from "./SeasonalWaiter.js";
import BindingsWaiter from "./BindingsWaiter.js";
/**
@ -60,6 +61,7 @@ const Manager = function(app) {
this.options = new OptionsWaiter(this.app);
this.highlighter = new HighlighterWaiter(this.app, this);
this.seasonal = new SeasonalWaiter(this.app, this);
this.bindings = new BindingsWaiter(this.app, this);
// Object to store dynamic handlers to fire on elements that may not exist yet
this.dynamicHandlers = {};
@ -89,7 +91,7 @@ Manager.prototype.initialiseEventListeners = function() {
window.addEventListener("focus", this.window.windowFocus.bind(this.window));
window.addEventListener("statechange", this.app.stateChange.bind(this.app));
window.addEventListener("popstate", this.app.popState.bind(this.app));
window.addEventListener("keydown", this.bindings.parseInput.bind(this.bindings));
// Controls
document.getElementById("bake").addEventListener("click", this.controls.bakeClick.bind(this.controls));
document.getElementById("auto-bake").addEventListener("change", this.controls.autoBakeChange.bind(this.controls));