소스 검색

完善 LocationBar 布局和事件相应功能

tags/1.13.2
Caven Chen 4 년 전
부모
커밋
c509c9a3e2
2개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. 11
    0
      src/core/widget/LocationBar.js
  2. 7
    0
      src/themes/locationbar.scss

+ 11
- 0
src/core/widget/LocationBar.js 파일 보기

@@ -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>

+ 7
- 0
src/themes/locationbar.scss 파일 보기

@@ -11,5 +11,12 @@
display: flex;
span {
margin: 0 8px;
display: inline-block;
}
.mouse-location{
span{
min-width: 125px;
}
}

}

Loading…
취소
저장