Commit fe4f4321 authored by 毛线's avatar 毛线

点击优化

parent 15c62341
......@@ -174,7 +174,7 @@ export default {
width: 170px;
height: 140px;
background-image: url(./static/left-block-bg.png);
background-size: 100%;
background-size: 100% 100%;
z-index: 1;
.logo {
width: 136px;
......
......@@ -35,12 +35,28 @@ export default {
mounted() {
this.GetBaseInfo()
this.GetDeviceList()
// this.network().isGaming()
},
methods: {
...mapActions([
'GetBaseInfo',
'GetDeviceList',
]),
network() {
return {
isGaming: () => {
const url = '/api/gaming/isGaming'
this.$request({
url,
method: 'get',
}).then(({ id }) => {
if (id) {
// this.$router.replace(`/game/${id}`)
}
})
},
}
},
},
}
</script>
......
<template>
<video id="jswebrtc" ref="jswebrtc" style="width: 100%;height: 100%;object-fit: fill" @click="(e) => handler().click(e)"/>
<video ref="jswebrtc" style="width: 100%;height: 100%;object-fit: fill" @click="(e) => handler().click(e)"/>
</template>
<script>
......@@ -53,7 +53,7 @@ export default {
}
// 获取承载元素dom
const videoDom = document.getElementById('jswebrtc')
const videoDom = this.$refs.jswebrtc
// 初始化播放器
this.player = new JSWebrtc.Player(url, {
......@@ -77,13 +77,13 @@ export default {
const video = this.$refs.jswebrtc
const { offsetWidth, offsetHeight } = video // 组件宽高
const { offsetX, offsetY } = e // 点击位置
const clickPercenX = (offsetHeight * zoom - offsetY) / (offsetHeight * zoom)
const clickPercenY = (offsetX) / (offsetWidth * zoom)
const clickPercenY = (offsetHeight * zoom - offsetY) / (offsetHeight * zoom)
const clickPercenX = (offsetX) / (offsetWidth * zoom)
// 计算点击区域对应的十六进制
const max = 32639
const x16 = (+(max * clickPercenX).toFixed(0)).toString(16)
const y16 = (+(max * clickPercenY).toFixed(0)).toString(16)
const x16 = (+(max * clickPercenX).toFixed(0)).toString(16)
this.$emit('click', {x16, y16})
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment