|
|
|
@@ -18,6 +18,7 @@ class LocationBar extends Widget { |
|
|
|
this._cameraEl = undefined |
|
|
|
this.type = Widget.getWidgetType('location_bar') |
|
|
|
this._state = State.INITIALIZED |
|
|
|
this._lastUpdate = Cesium.getTimestamp() |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -65,6 +66,11 @@ class LocationBar extends Widget { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
_moveHandler(e) { |
|
|
|
let now = Cesium.getTimestamp() |
|
|
|
if (now < this._lastUpdate + 300) { |
|
|
|
return |
|
|
|
} |
|
|
|
this._lastUpdate = now |
|
|
|
let ellipsoid = Cesium.Ellipsoid.WGS84 |
|
|
|
let cartographic = e.surfacePosition |
|
|
|
? ellipsoid.cartesianToCartographic(e.surfacePosition) |
|
|
|
@@ -81,6 +87,11 @@ class LocationBar extends Widget { |
|
|
|
} |
|
|
|
|
|
|
|
_cameraHandler() { |
|
|
|
let now = Cesium.getTimestamp() |
|
|
|
if (now < this._lastUpdate + 300) { |
|
|
|
return |
|
|
|
} |
|
|
|
this._lastUpdate = now |
|
|
|
let cameraPosition = this._viewer.cameraPosition |
|
|
|
this._cameraEl.innerHTML = ` |
|
|
|
<span>视角:${(+cameraPosition.pitch).toFixed(2)}</span> |