emotes sending on mouse down holding.

This commit is contained in:
Miroslav Šedivý
2021-11-17 18:37:33 +01:00
parent 4f0819b3f8
commit 8f0115e7b0
2 changed files with 20 additions and 2 deletions

View File

@ -1,8 +1,8 @@
<template>
<div class="emotes">
<div class="emotes" @mouseleave="stopSendingEmotes" @mouseup="stopSendingEmotes">
<ul v-if="!muted">
<li v-for="emote in recent" :key="emote">
<div @click.stop.prevent="sendEmote(emote)" :class="['emote', emote]" />
<div :class="['emote', emote]" @mousedown.stop.prevent="startSendingEmotes(emote)" />
</li>
<li>
<i @click.stop.prevent="open" class="fas fa-grin-beam"></i>
@ -171,5 +171,22 @@
}
this.$accessor.chat.sendEmote(emote)
}
private interval!: number
startSendingEmotes(emote: string) {
this.$accessor.chat.sendEmote(emote)
this.stopSendingEmotes()
this.interval = window.setInterval(() => {
this.$accessor.chat.sendEmote(emote)
}, 350)
}
stopSendingEmotes() {
if (this.interval) {
clearInterval(this.interval)
}
}
}
</script>