fix keyboard controls
This commit is contained in:
@@ -39,7 +39,6 @@ export default defineComponent({
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
sortingData: { direction: -1, argument: 'kills' as keyof Player | 'k/d' | 'avg_distance' },
|
sortingData: { direction: -1, argument: 'kills' as keyof Player | 'k/d' | 'avg_distance' },
|
||||||
playerIdList: [] as string[],
|
|
||||||
store: useKillStore()
|
store: useKillStore()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -115,11 +114,11 @@ export default defineComponent({
|
|||||||
if (!this.$props.playerHighlighted) return
|
if (!this.$props.playerHighlighted) return
|
||||||
if (!Object.keys(values).includes(e.key)) return
|
if (!Object.keys(values).includes(e.key)) return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const index = this.playerIdList.indexOf(this.$props.playerHighlighted)
|
const index = this.playerList.findIndex(e => e.id === this.$props.playerHighlighted)
|
||||||
let nextIndex = (index + values[e.key])
|
let nextIndex = (index + values[e.key])
|
||||||
if (nextIndex >= this.playerIdList.length) nextIndex = this.playerIdList.length - 1
|
if (nextIndex >= this.playerList.length) nextIndex = this.playerList.length - 1
|
||||||
if (nextIndex < 0) nextIndex = 0
|
if (nextIndex < 0) nextIndex = 0
|
||||||
this.$emit('highlightPlayer', this.playerIdList[nextIndex])
|
this.$emit('highlightPlayer', this.playerList[nextIndex].id)
|
||||||
},
|
},
|
||||||
updateSort (argument:string) {
|
updateSort (argument:string) {
|
||||||
if (this.sortingData.argument === argument) {
|
if (this.sortingData.argument === argument) {
|
||||||
|
|||||||
Reference in New Issue
Block a user