Skip to content

Commit

Permalink
edit anchor add params
Browse files Browse the repository at this point in the history
  • Loading branch information
cavencj committed Oct 16, 2024
1 parent 6bd8944 commit 3f10a24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 11 additions & 10 deletions src/modules/tools/DrawTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand All @@ -48,7 +47,7 @@ class DrawTool {
* @private
*/
_onClick(e) {
let position = this._getEventPosition(e);
let position = this._getEventPosition(e)
if (!position) {
return false
}
Expand All @@ -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
}
Expand All @@ -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))
}

/**
Expand All @@ -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,
},
Expand Down
4 changes: 3 additions & 1 deletion src/modules/tools/EditTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class EditTool {
image: image,
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
Expand Down

0 comments on commit 3f10a24

Please sign in to comment.