Proxy2
This commit is contained in:
parent
307042003e
commit
3d70e2689b
24
app.js
24
app.js
@ -71,24 +71,24 @@ const AWARDED_LINE_CLEARS = {
|
|||||||
|
|
||||||
const KEY_NAMES = new Proxy({
|
const KEY_NAMES = new Proxy({
|
||||||
["ArrowLeft"] : "←",
|
["ArrowLeft"] : "←",
|
||||||
["ArrowRight"] : "→",
|
|
||||||
["ArrowUp"] : "↑",
|
|
||||||
["ArrowDown"] : "↓",
|
|
||||||
[" "] : "Espace",
|
|
||||||
["Escape"] : "Échap.",
|
|
||||||
["Backspace"] : "Ret. arrière",
|
|
||||||
["Enter"] : "Entrée",
|
|
||||||
["←"] : "ArrowLeft",
|
["←"] : "ArrowLeft",
|
||||||
|
["ArrowRight"] : "→",
|
||||||
["→"] : "ArrowRight",
|
["→"] : "ArrowRight",
|
||||||
|
["ArrowUp"] : "↑",
|
||||||
["↑"] : "ArrowUp",
|
["↑"] : "ArrowUp",
|
||||||
|
["ArrowDown"] : "↓",
|
||||||
["↓"] : "ArrowDown",
|
["↓"] : "ArrowDown",
|
||||||
|
[" "] : "Espace",
|
||||||
["Espace"] : " ",
|
["Espace"] : " ",
|
||||||
|
["Escape"] : "Échap.",
|
||||||
["Échap."] : "Escape",
|
["Échap."] : "Escape",
|
||||||
|
["Backspace"] : "Ret. arrière",
|
||||||
["Ret. arrière"]: "Backspace",
|
["Ret. arrière"]: "Backspace",
|
||||||
|
["Enter"] : "Entrée",
|
||||||
["Entrée"] : "Enter",
|
["Entrée"] : "Enter",
|
||||||
}, {
|
}, {
|
||||||
get(obj, keyName) {
|
get(obj, keyName) {
|
||||||
return obj[keyName] || keyName
|
return keyName in obj? obj[keyName] : keyName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -496,16 +496,14 @@ Ghost.prototype.minoesPosition = [
|
|||||||
function changeKey() {
|
function changeKey() {
|
||||||
let controller = this
|
let controller = this
|
||||||
let input = controller.domElement.getElementsByTagName("input")[0]
|
let input = controller.domElement.getElementsByTagName("input")[0]
|
||||||
|
let action = settings.keyBind[KEY_NAMES[input.value]]
|
||||||
|
delete settings.keyBind[KEY_NAMES[input.value]]
|
||||||
input.select()
|
input.select()
|
||||||
input.onkeydown = function (event) {
|
input.onkeydown = function (event) {
|
||||||
controller.setValue(KEY_NAMES[event.key])
|
controller.setValue(KEY_NAMES[event.key])
|
||||||
|
settings.keyBind[event.key] = action
|
||||||
input.blur()
|
input.blur()
|
||||||
}
|
}
|
||||||
input.onblur = function (event) {
|
|
||||||
input.onkeydown = null
|
|
||||||
input.onblur = null
|
|
||||||
settings.bindKeys()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user