Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/client/src/components/resolution.vue

141 lines
2.9 KiB
Vue
Raw Normal View History

2020-02-11 18:15:59 +13:00
<template>
<vue-context class="context" ref="context">
<template v-for="(conf, i) in configurations">
2020-02-11 19:11:07 +13:00
<li
v-for="(fps, j) in conf.rates"
:key="`${i}-${j}`"
@click="screenSet(conf.width, conf.height, fps)"
:class="[conf.width === width && conf.height === height && fps === rate ? 'active' : '']"
>
2020-02-11 18:15:59 +13:00
<i class="fas fa-desktop"></i>
<span>{{ conf.width }}x{{ conf.height }}</span>
2020-02-11 19:11:07 +13:00
<small>{{ fps }}</small>
2020-02-11 18:15:59 +13:00
</li>
</template>
</vue-context>
</template>
<style lang="scss" scoped>
.context {
background-color: $background-floating;
background-clip: padding-box;
border-radius: 0.25rem;
display: block;
margin: 0;
padding: 5px;
min-width: 150px;
z-index: 1500;
position: fixed;
list-style: none;
box-sizing: border-box;
max-height: calc(100% - 50px);
overflow-y: auto;
color: $interactive-normal;
user-select: none;
box-shadow: $elevation-high;
scrollbar-width: thin;
scrollbar-color: $background-secondary transparent;
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-track {
background-color: transparent;
}
&::-webkit-scrollbar-thumb {
background-color: $background-secondary;
border: 2px solid $background-floating;
border-radius: 4px;
}
&::-webkit-scrollbar-thumb:hover {
background-color: $background-floating;
}
> li {
margin: 0;
position: relative;
align-content: center;
display: flex;
flex-direction: row;
padding: 8px 5px;
cursor: pointer;
2020-02-11 19:11:07 +13:00
border-radius: 3px;
2020-02-11 18:15:59 +13:00
i {
margin-right: 10px;
}
span {
flex-grow: 1;
}
small {
font-size: 0.7em;
justify-self: flex-end;
align-self: flex-end;
}
2020-02-11 19:11:07 +13:00
&.active,
2020-02-11 18:15:59 +13:00
&:hover,
&:focus {
text-decoration: none;
background-color: $background-modifier-hover;
color: $interactive-hover;
}
&:focus {
outline: 0;
}
}
&:focus {
outline: 0;
}
}
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Member } from '~/neko/types'
// @ts-ignore
import { VueContext } from 'vue-context'
@Component({
name: 'neko-resolution',
components: {
'vue-context': VueContext,
},
})
export default class extends Vue {
@Ref('context') readonly context!: any
2020-02-11 19:11:07 +13:00
get width() {
return this.$accessor.video.width
}
get height() {
return this.$accessor.video.height
}
get rate() {
return this.$accessor.video.rate
}
2020-02-11 18:15:59 +13:00
get configurations() {
return this.$accessor.video.configurations
}
open(event: MouseEvent) {
this.context.open(event)
}
screenSet(width: number, height: number, rate: number) {
this.$accessor.video.screenSet({ width, height, rate })
}
}
</script>