Archived
2
0

shake keyboard icon.

This commit is contained in:
m1k1o 2021-04-04 16:57:23 +02:00
parent a7ab37a4f5
commit abd1a76965
4 changed files with 62 additions and 3 deletions

View File

@ -40,6 +40,7 @@ For n.eko room management software visit https://github.com/m1k1o/neko-rooms.
- Added simple language picker.
- Added `?usr=<display-name>` that will prefill username. This allows creating auto-join links.
- Added `?cast=1` that will hide all control and show only video.
- Shake keyboard icon if someone attempted to control when is nobody hosting.
### Bugs
- Fixed minor gst pipeline bug.

View File

@ -9,7 +9,7 @@
<neko-header />
</div>
<div class="video-container">
<neko-video ref="video" :hideControls="hideControls" />
<neko-video ref="video" :hideControls="hideControls" @control-attempt="controlAttempt" />
</div>
<div v-if="!hideControls" class="room-container">
<neko-members />
@ -18,7 +18,7 @@
<neko-menu />
</div>
<div class="controls">
<neko-controls />
<neko-controls :shakeKbd="shakeKbd" />
</div>
<div class="emotes">
<neko-emotes />
@ -174,6 +174,8 @@
export default class extends Vue {
@Ref('video') video!: Video
shakeKbd = false
get hideControls() {
return !!new URL(location.href).searchParams.get('cast')
}
@ -184,6 +186,13 @@
this.$accessor.settings.setSound(false)
}
controlAttempt() {
if (this.shakeKbd || this.$accessor.remote.hosted) return
this.shakeKbd = true
setTimeout(() => (this.shakeKbd = false), 5000)
}
get about() {
return this.$accessor.client.about
}

View File

@ -3,6 +3,7 @@
<li v-if="!isTouch">
<i
:class="[
shakeKbd ? 'shake' : '',
hosted && !hosting ? 'disabled' : '',
!hosted && !hosting ? 'faded' : '',
'fas',
@ -53,6 +54,46 @@
</template>
<style lang="scss" scoped>
.shake {
animation: shake 1.25s cubic-bezier(0, 0, 0, 1);
}
@keyframes shake {
0% {
transform: scale(1) translate(0px, 0) rotate(0);
}
10% {
transform: scale(1.25) translate(-2px, -2px) rotate(-20deg);
}
20% {
transform: scale(1.5) translate(4px, -4px) rotate(20deg);
}
30% {
transform: scale(1.75) translate(-4px, -6px) rotate(-20deg);
}
40% {
transform: scale(2) translate(6px, -8px) rotate(20deg);
}
50% {
transform: scale(2.25) translate(-6px, -10px) rotate(-20deg);
}
60% {
transform: scale(2) translate(6px, -8px) rotate(20deg);
}
70% {
transform: scale(1.75) translate(-4px, -6px) rotate(-20deg);
}
80% {
transform: scale(1.5) translate(4px, -4px) rotate(20deg);
}
90% {
transform: scale(1.25) translate(-2px, -2px) rotate(-20deg);
}
100% {
transform: scale(1) translate(0px, 0) rotate(0);
}
}
ul {
display: flex;
flex-direction: row;
@ -195,10 +236,12 @@
</style>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { Vue, Component, Prop } from 'vue-property-decorator'
@Component({ name: 'neko-controls' })
export default class extends Vue {
@Prop(Boolean) readonly shakeKbd = false
get isTouch() {
return (
(typeof navigator.maxTouchPoints !== 'undefined' ? navigator.maxTouchPoints < 0 : false) ||

View File

@ -552,9 +552,14 @@
}
onMouseDown(e: MouseEvent) {
if (!this.hosting) {
this.$emit('control-attempt', e)
}
if (!this.hosting || this.locked) {
return
}
this.onMousePos(e)
this.$client.sendData('mousedown', { key: e.button + 1 })
}
@ -563,6 +568,7 @@
if (!this.hosting || this.locked) {
return
}
this.onMousePos(e)
this.$client.sendData('mouseup', { key: e.button + 1 })
}