吉安感知网项目-前端
shuishen
7 days ago 6e88705bd5b443a259b24c17c8a299765d059d96
applications/drone-command/src/utils/cesium/shapeTools/draw/DrawEllipseTool.js
@@ -37,7 +37,7 @@
      this.handler.setInputAction(movement => this.handleMouseMove(movement), Cesium.ScreenSpaceEventType.MOUSE_MOVE)
      this.drawStep = 0
      this.isCompleted = false
      this.tooltip.show('单击设置中心点', { x: 0, y: 0 })
      this.tooltip.hide()
   }
   handleLeftClick(click) {
@@ -87,7 +87,17 @@
   handleMouseMove(movement) {
      if (this.isCompleted) return
      this.tooltip.move(movement.endPosition)
      const tipText = this.drawStep === 0
         ? '单击设置中心点'
         : this.drawStep === 1
            ? '单击设置长轴'
            : '单击设置短轴'
      if (!this.tooltip?.isVisible) {
         this.tooltip.show(tipText, movement.endPosition)
      } else {
         this.tooltip.show(tipText)
         this.tooltip.move(movement.endPosition)
      }
      if (!this.isDrawing) return
      const position = this.getPositionFromScreen(movement.endPosition)
      if (!position) return
@@ -134,7 +144,8 @@
   getPositionFromScreen(screenPosition) {
      const scene = this.viewer.scene
      const cartesian = scene.pickPosition(screenPosition)
      const ray = scene.camera.getPickRay(screenPosition)
      const cartesian = ray ? scene.globe.pick(ray, scene) : null
      if (cartesian) return cartesian
      return scene.camera.pickEllipsoid(screenPosition, scene.globe.ellipsoid)
   }