aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorNick Coutsos <[email protected]>2021-12-14 18:01:11 -0500
committerNick Coutsos <[email protected]>2021-12-14 18:01:11 -0500
commitc9008316b5e0f73581a35348ea421ea485a4f0cf (patch)
treee558bc3d241a2370a332f71ce95c90952c6370c8 /application
parentc9d70d5734e3496f992f3a4d9aa3c046526b1592 (diff)
downloadkeymap-editor-c9008316b5e0f73581a35348ea421ea485a4f0cf.tar.gz
keymap-editor-c9008316b5e0f73581a35348ea421ea485a4f0cf.zip
Fill in any missing key binds with &none
Diffstat (limited to 'application')
-rw-r--r--application/components/keyboard-layout.vue19
1 files changed, 14 insertions, 5 deletions
diff --git a/application/components/keyboard-layout.vue b/application/components/keyboard-layout.vue
index 3680f7c..48102be 100644
--- a/application/components/keyboard-layout.vue
+++ b/application/components/keyboard-layout.vue
@@ -8,9 +8,8 @@
:rotation="rotation(key)"
:size="size(key)"
:label="key.label"
- :parsed="keys[i]"
- :value="keys[i].value"
- :params="keys[i].params"
+ :value="normalized[i].value"
+ :params="normalized[i].params"
@update="handleUpdateBind(i, $event)"
/>
</div>
@@ -25,6 +24,16 @@ export default {
components: {
'key-thing': Key,
},
+ computed: {
+ normalized() {
+ return this.layout.map((_, i) => (
+ this.keys[i] || {
+ value: '&none',
+ params: []
+ }
+ ))
+ }
+ },
methods: {
position(key) {
const { x, y } = key
@@ -40,9 +49,9 @@ export default {
},
handleUpdateBind(keyIndex, updatedBinding) {
this.$emit('update', [
- ...this.keys.slice(0, keyIndex),
+ ...this.normalized.slice(0, keyIndex),
updatedBinding,
- ...this.keys.slice(keyIndex + 1)
+ ...this.normalized.slice(keyIndex + 1)
])
}
}