소스 검색

reset location bar delay

tags/2.0.0
Caven Chen 4 년 전
부모
커밋
819d470e24
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6
    5
      modules/widget/type/LocationBar.js

+ 6
- 5
modules/widget/type/LocationBar.js 파일 보기

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>

Loading…
취소
저장