| | |
| | | this.handler.setInputAction(evt => this.handleLeftDown(evt), Cesium.ScreenSpaceEventType.LEFT_DOWN) |
| | | this.handler.setInputAction(evt => this.handleMouseMove(evt), Cesium.ScreenSpaceEventType.MOUSE_MOVE) |
| | | this.handler.setInputAction(() => this.handleLeftUp(), Cesium.ScreenSpaceEventType.LEFT_UP) |
| | | this.tooltip.show('拖动顶点编辑', { x: 0, y: 0 }) |
| | | this.tooltip.hide() |
| | | } |
| | | |
| | | handleLeftDown(evt) { |
| | |
| | | } |
| | | |
| | | handleMouseMove(evt) { |
| | | this.tooltip.move(evt.endPosition) |
| | | if (!this.tooltip?.isVisible) { |
| | | this.tooltip.show('拖动顶点编辑', evt.endPosition) |
| | | } else { |
| | | this.tooltip.show('拖动顶点编辑') |
| | | this.tooltip.move(evt.endPosition) |
| | | } |
| | | if (this.dragIndex == null) return |
| | | const position = this.getPositionFromScreen(evt.endPosition) |
| | | if (!position) return |
| | |
| | | |
| | | 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) |
| | | } |