吉安感知网项目-前端
shuishen
2026-01-31 50eae3d37dbc8e210b845c6b959c9b7dedb88d01
feat:tooltip提示优化
2 files modified
28 ■■■■■ changed files
applications/drone-command/env/.env.development 4 ●●●● patch | view | raw | blame | history
applications/drone-command/src/utils/cesium/shapeTools/Tooltip.js 24 ●●●●● patch | view | raw | blame | history
applications/drone-command/env/.env.development
@@ -2,7 +2,7 @@
 # @Author       : yuan
 # @Date         : 2026-01-31 14:34:31
 # @LastEditors  : yuan
 # @LastEditTime : 2026-01-31 14:49:37
 # @LastEditTime : 2026-01-31 15:18:17
 # @FilePath     : \applications\drone-command\env\.env.development
 # @Description  : 
 # Copyright 2026 OBKoro1, All Rights Reserved. 
@@ -16,7 +16,7 @@
#开发环境代理地址(推荐本地新建文件 .env.development.local 来进行覆盖)
# VITE_APP_URL=https://wrj.shuixiongit.com/api
VITE_APP_URL=http://192.168.1.204
VITE_APP_URL=http://192.168.1.33
#新大屏地址
VITE_APP_DASHBOARD_URL='https://wrj.shuixiongit.com/command-center-dashboard/'
applications/drone-command/src/utils/cesium/shapeTools/Tooltip.js
@@ -5,6 +5,7 @@
        this.container = viewer?.container || null
        this.tooltipEl = null
        this.isVisible = false
        this.handleMouseLeave = this.handleMouseLeave.bind(this)
        this.init()
    }
@@ -23,6 +24,8 @@
        el.style.display = 'none'
        this.container.appendChild(el)
        this.tooltipEl = el
        this.container.addEventListener('mouseleave', this.handleMouseLeave)
        this.container.addEventListener('pointerleave', this.handleMouseLeave)
    }
    show(text, position) {
@@ -35,6 +38,19 @@
    move(position) {
        if (!this.tooltipEl || !position) return
        const width = this.container?.clientWidth ?? 0
        const height = this.container?.clientHeight ?? 0
        if (
            !width ||
            !height ||
            position.x < 0 ||
            position.y < 0 ||
            position.x > width ||
            position.y > height
        ) {
            this.hide()
            return
        }
        const offset = this.options.offset || { x: 12, y: 12 }
        this.tooltipEl.style.left = `${position.x + offset.x}px`
        this.tooltipEl.style.top = `${position.y + offset.y}px`
@@ -46,8 +62,16 @@
        this.isVisible = false
    }
    handleMouseLeave() {
        this.hide()
    }
    destroy() {
        this.hide()
        if (this.container) {
            this.container.removeEventListener('mouseleave', this.handleMouseLeave)
            this.container.removeEventListener('pointerleave', this.handleMouseLeave)
        }
        if (this.tooltipEl && this.container) {
            this.container.removeChild(this.tooltipEl)
        }