@geoblocks/cesium-compass
Advanced tools
Comparing version 0.4.2 to 0.5.0
@@ -236,2 +236,5 @@ // Original code from TerriaJS | ||
handleRotatePointerMove(event) { | ||
if (this.moveUpIfTooCloseToTerrain()) { | ||
return; | ||
} | ||
const camera = this.scene.camera; | ||
@@ -312,2 +315,5 @@ clickLocationScratch.x = event.clientX - this.context.compassRectangle.left; | ||
handleOrbitTick() { | ||
if (this.moveUpIfTooCloseToTerrain()) { | ||
return; | ||
} | ||
const camera = this.scene.camera; | ||
@@ -338,2 +344,21 @@ const timestamp = performance.now(); | ||
distanceToTerrain() { | ||
const camera = this.scene.camera; | ||
const height = this.scene.globe.getHeight(camera.positionCartographic); | ||
return camera.positionCartographic.height - height; | ||
} | ||
moveUpIfTooCloseToTerrain() { | ||
const controller = this.scene.screenSpaceCameraController; | ||
if (!controller.enableCollisionDetection) { | ||
return false; | ||
} | ||
const distanceDiff = this.distanceToTerrain() - controller.minimumZoomDistance; | ||
if (CesiumMath.lessThan(distanceDiff, 0.0, CesiumMath.EPSILON1)) { | ||
this.scene.camera.moveUp(-distanceDiff); | ||
return true; | ||
} | ||
return false; | ||
} | ||
/** | ||
@@ -340,0 +365,0 @@ * @param {Cartesian2} vector |
{ | ||
"name": "@geoblocks/cesium-compass", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"license": "BSD-3-Clause", | ||
@@ -17,3 +17,3 @@ "repository": "github:geoblocks/cesium-helpers", | ||
}, | ||
"gitHead": "e3b8b8ce9751e3902faeeda37f59ed81a3b318c9" | ||
"gitHead": "92649db7086e59de94fba975b3423e50288fa0ea" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20962
364