|
@@ -9,7 +9,9 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><TopLeft /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <TopLeft />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -17,7 +19,9 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><Top /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Top />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -25,7 +29,9 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><TopRight /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <TopRight />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -33,10 +39,14 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><Back /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Back />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="ptz-btn ptz-center">
|
|
<div class="ptz-btn ptz-center">
|
|
|
- <el-icon><Aim /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Aim />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -44,7 +54,9 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><Right /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Right />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -52,7 +64,9 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><BottomLeft /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <BottomLeft />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -60,7 +74,9 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><Bottom /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Bottom />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="ptz-btn"
|
|
class="ptz-btn"
|
|
@@ -68,13 +84,17 @@
|
|
|
@mouseup="handleDirectionStop"
|
|
@mouseup="handleDirectionStop"
|
|
|
@mouseleave="handleDirectionStop"
|
|
@mouseleave="handleDirectionStop"
|
|
|
>
|
|
>
|
|
|
- <el-icon><BottomRight /></el-icon>
|
|
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <BottomRight />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 垂直缩放滑块 -->
|
|
<!-- 垂直缩放滑块 -->
|
|
|
<div class="ptz-zoom">
|
|
<div class="ptz-zoom">
|
|
|
- <el-icon class="zoom-icon zoom-in"><ZoomIn /></el-icon>
|
|
|
|
|
|
|
+ <el-icon class="zoom-icon zoom-in">
|
|
|
|
|
+ <ZoomIn />
|
|
|
|
|
+ </el-icon>
|
|
|
<el-slider
|
|
<el-slider
|
|
|
v-model="zoomValue"
|
|
v-model="zoomValue"
|
|
|
vertical
|
|
vertical
|
|
@@ -86,7 +106,9 @@
|
|
|
@input="handleZoomChange"
|
|
@input="handleZoomChange"
|
|
|
@change="handleZoomRelease"
|
|
@change="handleZoomRelease"
|
|
|
/>
|
|
/>
|
|
|
- <el-icon class="zoom-icon zoom-out"><ZoomOut /></el-icon>
|
|
|
|
|
|
|
+ <el-icon class="zoom-icon zoom-out">
|
|
|
|
|
+ <ZoomOut />
|
|
|
|
|
+ </el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -108,6 +130,7 @@ import {
|
|
|
ZoomOut
|
|
ZoomOut
|
|
|
} from '@element-plus/icons-vue'
|
|
} from '@element-plus/icons-vue'
|
|
|
import { ptzControl } from '@/api/camera'
|
|
import { ptzControl } from '@/api/camera'
|
|
|
|
|
+import type { PTZAction } from '@/types'
|
|
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
|
cameraId?: string
|
|
cameraId?: string
|
|
@@ -126,35 +149,37 @@ const zoomValue = ref(0)
|
|
|
const ptzSpeed = 50
|
|
const ptzSpeed = 50
|
|
|
|
|
|
|
|
// 方向映射
|
|
// 方向映射
|
|
|
-const directionToCommand: Record<string, string> = {
|
|
|
|
|
- UP: 'up',
|
|
|
|
|
- DOWN: 'down',
|
|
|
|
|
- LEFT: 'left',
|
|
|
|
|
- RIGHT: 'right',
|
|
|
|
|
- UP_LEFT: 'up',
|
|
|
|
|
- UP_RIGHT: 'up',
|
|
|
|
|
- DOWN_LEFT: 'down',
|
|
|
|
|
- DOWN_RIGHT: 'down',
|
|
|
|
|
- STOP: 'stop'
|
|
|
|
|
|
|
+const directionToAction: Record<string, PTZAction> = {
|
|
|
|
|
+ up: 'up',
|
|
|
|
|
+ down: 'down',
|
|
|
|
|
+ left: 'left',
|
|
|
|
|
+ right: 'right',
|
|
|
|
|
+ up_left: 'up_left',
|
|
|
|
|
+ up_right: 'up_right',
|
|
|
|
|
+ down_left: 'down_left',
|
|
|
|
|
+ down_right: 'down_right',
|
|
|
|
|
+ zoom_in: 'zoom_in',
|
|
|
|
|
+ zoom_out: 'zoom_out',
|
|
|
|
|
+ stop: 'stop'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleDirection(direction: string) {
|
|
async function handleDirection(direction: string) {
|
|
|
if (!props.cameraId) return
|
|
if (!props.cameraId) return
|
|
|
emit('ptz-action', 'direction', { direction })
|
|
emit('ptz-action', 'direction', { direction })
|
|
|
- const command = directionToCommand[direction] || 'stop'
|
|
|
|
|
- await ptzControl({ cameraId: props.cameraId, command, speed: ptzSpeed })
|
|
|
|
|
|
|
+ const command = directionToAction[direction]
|
|
|
|
|
+ await ptzControl({ cameraId: props.cameraId, action: command, speed: ptzSpeed })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleDirectionStop() {
|
|
async function handleDirectionStop() {
|
|
|
if (!props.cameraId) return
|
|
if (!props.cameraId) return
|
|
|
emit('ptz-action', 'stop')
|
|
emit('ptz-action', 'stop')
|
|
|
- await ptzControl({ cameraId: props.cameraId, command: 'stop' })
|
|
|
|
|
|
|
+ await ptzControl({ cameraId: props.cameraId, action: 'stop' })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleZoomChange(val: number) {
|
|
async function handleZoomChange(val: number) {
|
|
|
if (!props.cameraId) return
|
|
if (!props.cameraId) return
|
|
|
if (val === 0) {
|
|
if (val === 0) {
|
|
|
- await ptzControl({ cameraId: props.cameraId, command: 'stop' })
|
|
|
|
|
|
|
+ await ptzControl({ cameraId: props.cameraId, action: 'stop' })
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|