Browse Source

Show only available shortcut keys, fix #1052

pull/1071/head
Hironsan 4 years ago
parent
commit
1bd9117e37
1 changed files with 7 additions and 1 deletions
  1. 8
      frontend/components/containers/labels/LabelList.vue

8
frontend/components/containers/labels/LabelList.vue

@ -47,7 +47,7 @@
<template v-slot:input> <template v-slot:input>
<v-select <v-select
:value="item.suffix_key" :value="item.suffix_key"
:items="shortkeys"
:items="availableShortkeys(item.suffix_key)"
:label="$t('annotation.key')" :label="$t('annotation.key')"
@change="handleUpdateLabel({ id: item.id, suffix_key: $event })" @change="handleUpdateLabel({ id: item.id, suffix_key: $event })"
/> />
@ -133,6 +133,12 @@ export default {
this.updateLabel(data) this.updateLabel(data)
}, },
availableShortkeys(suffixKey) {
const usedKeys = this.items.map(item => item.suffix_key)
const unusedKeys = this.shortkeys.filter(item => item === suffixKey || !usedKeys.includes(item))
return unusedKeys
},
textColor(backgroundColor) { textColor(backgroundColor) {
return idealColor(backgroundColor) return idealColor(backgroundColor)
} }

Loading…
Cancel
Save