Pārlūkot izejas kodu

reset location bar delay

tags/2.0.0
Caven Chen pirms 4 gadiem
vecāks
revīzija
819d470e24
1 mainītis faili ar 6 papildinājumiem un 5 dzēšanām
  1. 6
    5
      modules/widget/type/LocationBar.js

+ 6
- 5
modules/widget/type/LocationBar.js Parādīt failu

@@ -17,7 +17,8 @@ class LocationBar extends Widget {
this._cameraEl = undefined
this.type = Widget.getWidgetType('location_bar')
this._state = State.INITIALIZED
this._lastUpdate = Cesium.getTimestamp()
this._lastMouseUpdate = Cesium.getTimestamp()
this._lastCameraUpdate = Cesium.getTimestamp()
}

/**
@@ -66,10 +67,10 @@ class LocationBar extends Widget {
*/
_moveHandler(e) {
let now = Cesium.getTimestamp()
if (now < this._lastUpdate + 300) {
if (now < this._lastMouseUpdate + 300) {
return
}
this._lastUpdate = now
this._lastMouseUpdate = now
let ellipsoid = Cesium.Ellipsoid.WGS84
let cartographic = e.surfacePosition
? ellipsoid.cartesianToCartographic(e.surfacePosition)
@@ -91,10 +92,10 @@ class LocationBar extends Widget {
*/
_cameraHandler() {
let now = Cesium.getTimestamp()
if (now < this._lastUpdate + 300) {
if (now < this._lastCameraUpdate + 300) {
return
}
this._lastUpdate = now
this._lastCameraUpdate = now
let cameraPosition = this._viewer.cameraPosition
this._cameraEl.innerHTML = `
<span>视角:${(+cameraPosition.pitch).toFixed(2)}</span>

Notiek ielāde…
Atcelt
Saglabāt