forked from drone/command-center-dashboard

罗广辉
2025-04-17 bf483860821fb7a3dbeb9c76192c1c1e3e35f1df
src/hooks/controlDrone/useManualControl.js
@@ -40,7 +40,6 @@
   let genPortOne = true //是一代机场
   const mqttHooks = useMqtt(mqttState,deviceTopicInfo)
   let seq = 0
   let throttledPtz = null
   function handlePublish(params) {
      const body = {
@@ -131,24 +130,29 @@
            activeCodeKey.value = keyCode
            break
         case 'ArrowUp':
            ptzThrottle[0]()
            if (activeCodeKey.value === keyCode) return
            myInterval = setInterval(()=>ptzControl('up'), 50)
            activeCodeKey.value = keyCode
            break
         case 'ArrowDown':
            ptzThrottle[1]()
            if (activeCodeKey.value === keyCode) return
            myInterval = setInterval(()=>ptzControl('down'), 50)
            activeCodeKey.value = keyCode
            break
         case 'ArrowLeft':
            ptzThrottle[2]()
            if (activeCodeKey.value === keyCode) return
            myInterval = setInterval(()=>ptzControl('left'), 50)
            activeCodeKey.value = keyCode
            break
         case 'ArrowRight':
            ptzThrottle[3]()
            if (activeCodeKey.value === keyCode) return
            myInterval = setInterval(()=>ptzControl('right'), 50)
            activeCodeKey.value = keyCode
            break
         default:
            break
      }
   }
   // 云台控制节流list
   const ptzThrottle = ['up','down','left','right'].map(key => throttle(()=>ptzControl(key), 500))
   // 云台上下左右
   function ptzControl(key) {