aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/components/key.vue
diff options
context:
space:
mode:
Diffstat (limited to 'application/components/key.vue')
-rw-r--r--application/components/key.vue20
1 files changed, 18 insertions, 2 deletions
diff --git a/application/components/key.vue b/application/components/key.vue
index 315a2e9..b44fb1e 100644
--- a/application/components/key.vue
+++ b/application/components/key.vue
@@ -31,6 +31,7 @@
:code="editing.code"
:param="editing.param"
:targets="editing.targets"
+ :prompt="createPromptMessage(editing.param)"
@select="handleSelectValue"
@cancel="editing = null"
/>
@@ -153,6 +154,21 @@ export default {
}
},
methods: {
+ createPromptMessage(param) {
+ const promptMapping = {
+ layer: 'Select layer',
+ mod: 'Select modifier',
+ behaviour: 'Select behaviour',
+ command: 'Select command',
+ keycode: 'Select key code'
+ }
+
+ if (param.name) {
+ return `Select ${param.name}`
+ }
+
+ return promptMapping[param] || promptMapping.keycode
+ },
onMouseOver(event) {
const old = document.querySelector('.highlight')
old && old.classList.remove('highlight')
@@ -163,12 +179,12 @@ export default {
},
handleSelectCode(event) {
this.editing = pick(event, ['target', 'codeIndex', 'code', 'param'])
- this.editing.targets = this.getSearchTargets(this.editing.param)
+ this.editing.targets = this.getSearchTargets(this.editing.param, this.value)
},
handleSelectBehaviour(event) {
this.editing = {
target: event.target,
- targets: this.getSearchTargets('behaviour'),
+ targets: this.getSearchTargets('behaviour', this.value),
codeIndex: 0,
code: this.value,
param: 'behaviour'