浏览代码

Merge pull request #195 from deyihu/194

drawtool support ground point when clampToModel
tags/4.0.0
Caven Chen 1年前
父节点
当前提交
f7a61aab5e
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 16 次插入9 次删除
  1. 16
    9
      src/modules/tools/DrawTool.js

+ 16
- 9
src/modules/tools/DrawTool.js 查看文件

this._tooltipMess = tooltipMess this._tooltipMess = tooltipMess
} }


_getEventPosition(e) {
const { overlay, layer, position, surfacePosition } = e;
if (!this._options.clampToModel) {
return surfacePosition;
}
if (!overlay && !layer) {
return surfacePosition;
}
return position;

}

/** /**
* *
* @param e * @param e
* @private * @private
*/ */
_onClick(e) { _onClick(e) {
let position =
this._options.clampToModel && e.position ? e.position : e.surfacePosition
let position = this._getEventPosition(e);
if (!position) { if (!position) {
return false return false
} }
*/ */
_onMouseMove(e) { _onMouseMove(e) {
this._viewer.tooltip.showAt(e.windowPosition, this._tooltipMess) this._viewer.tooltip.showAt(e.windowPosition, this._tooltipMess)
let position =
this._options.clampToModel && e.position ? e.position : e.surfacePosition
let position = this._getEventPosition(e);
if (!position) { if (!position) {
return false return false
} }
* @private * @private
*/ */
_onRightClick(e) { _onRightClick(e) {
this._plotEvent.fire(
PlotEventType.DRAW_STOP,
this._options.clampToModel && e.position ? e.position : e.surfacePosition
)
this._plotEvent.fire(PlotEventType.DRAW_STOP, this._getEventPosition(e));
} }


/** /**
eyeOffset: new Cesium.Cartesian3(0, 0, -100), eyeOffset: new Cesium.Cartesian3(0, 0, -100),
heightReference: heightReference:
this._viewer.scene.mode === Cesium.SceneMode.SCENE3D && this._viewer.scene.mode === Cesium.SceneMode.SCENE3D &&
!this._options.clampToModel
!this._options.clampToModel
? Cesium.HeightReference.CLAMP_TO_GROUND ? Cesium.HeightReference.CLAMP_TO_GROUND
: Cesium.HeightReference.NONE, : Cesium.HeightReference.NONE,
}, },

正在加载...
取消
保存