|
|
|
@@ -30,15 +30,14 @@ class DrawTool { |
|
|
|
} |
|
|
|
|
|
|
|
_getEventPosition(e) { |
|
|
|
const { overlay, layer, position, surfacePosition } = e; |
|
|
|
const { overlay, layer, position, surfacePosition } = e |
|
|
|
if (!this._options.clampToModel) { |
|
|
|
return surfacePosition; |
|
|
|
return surfacePosition |
|
|
|
} |
|
|
|
if (!overlay && !layer) { |
|
|
|
return surfacePosition; |
|
|
|
return surfacePosition |
|
|
|
} |
|
|
|
return position; |
|
|
|
|
|
|
|
return position |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -48,7 +47,7 @@ class DrawTool { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_onClick(e) { |
|
|
|
let position = this._getEventPosition(e); |
|
|
|
let position = this._getEventPosition(e) |
|
|
|
if (!position) { |
|
|
|
return false |
|
|
|
} |
|
|
|
@@ -65,7 +64,7 @@ class DrawTool { |
|
|
|
*/ |
|
|
|
_onMouseMove(e) { |
|
|
|
this._viewer.tooltip.showAt(e.windowPosition, this._tooltipMess) |
|
|
|
let position = this._getEventPosition(e); |
|
|
|
let position = this._getEventPosition(e) |
|
|
|
if (!position) { |
|
|
|
return false |
|
|
|
} |
|
|
|
@@ -79,7 +78,7 @@ class DrawTool { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_onRightClick(e) { |
|
|
|
this._plotEvent.fire(PlotEventType.DRAW_STOP, this._getEventPosition(e)); |
|
|
|
this._plotEvent.fire(PlotEventType.DRAW_STOP, this._getEventPosition(e)) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -96,10 +95,12 @@ class DrawTool { |
|
|
|
image: isCenter ? this._options.icon_center : this._options.icon_anchor, |
|
|
|
width: this._options.icon_size[0], |
|
|
|
height: this._options.icon_size[1], |
|
|
|
eyeOffset: new Cesium.Cartesian3(0, 0, -100), |
|
|
|
pixelOffset: this._options.pixelOffset || new Cesium.Cartesian2(0, 0), |
|
|
|
eyeOffset: this._options.eyeOffset || new Cesium.Cartesian3(0, 0, -100), |
|
|
|
disableDepthTestDistance: this._options.disableDepthTestDistance ?? 0, |
|
|
|
heightReference: |
|
|
|
this._viewer.scene.mode === Cesium.SceneMode.SCENE3D && |
|
|
|
!this._options.clampToModel |
|
|
|
!this._options.clampToModel |
|
|
|
? Cesium.HeightReference.CLAMP_TO_GROUND |
|
|
|
: Cesium.HeightReference.NONE, |
|
|
|
}, |