| this._cameraEl = undefined | this._cameraEl = undefined | ||||
| this.type = Widget.getWidgetType('location_bar') | this.type = Widget.getWidgetType('location_bar') | ||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| this._lastUpdate = Cesium.getTimestamp() | |||||
| this._lastMouseUpdate = Cesium.getTimestamp() | |||||
| this._lastCameraUpdate = Cesium.getTimestamp() | |||||
| } | } | ||||
| /** | /** | ||||
| */ | */ | ||||
| _moveHandler(e) { | _moveHandler(e) { | ||||
| let now = Cesium.getTimestamp() | let now = Cesium.getTimestamp() | ||||
| if (now < this._lastUpdate + 300) { | |||||
| if (now < this._lastMouseUpdate + 300) { | |||||
| return | return | ||||
| } | } | ||||
| this._lastUpdate = now | |||||
| this._lastMouseUpdate = now | |||||
| let ellipsoid = Cesium.Ellipsoid.WGS84 | let ellipsoid = Cesium.Ellipsoid.WGS84 | ||||
| let cartographic = e.surfacePosition | let cartographic = e.surfacePosition | ||||
| ? ellipsoid.cartesianToCartographic(e.surfacePosition) | ? ellipsoid.cartesianToCartographic(e.surfacePosition) | ||||
| */ | */ | ||||
| _cameraHandler() { | _cameraHandler() { | ||||
| let now = Cesium.getTimestamp() | let now = Cesium.getTimestamp() | ||||
| if (now < this._lastUpdate + 300) { | |||||
| if (now < this._lastCameraUpdate + 300) { | |||||
| return | return | ||||
| } | } | ||||
| this._lastUpdate = now | |||||
| this._lastCameraUpdate = now | |||||
| let cameraPosition = this._viewer.cameraPosition | let cameraPosition = this._viewer.cameraPosition | ||||
| this._cameraEl.innerHTML = ` | this._cameraEl.innerHTML = ` | ||||
| <span>视角:${(+cameraPosition.pitch).toFixed(2)}</span> | <span>视角:${(+cameraPosition.pitch).toFixed(2)}</span> |