| ### 1.14.0 - 2021-01-09 | ### 1.14.0 - 2021-01-09 | ||||
| > 1. 升级 Cesium 到 1.77.0 | > 1. 升级 Cesium 到 1.77.0 | ||||
| > 2. 完善罗盘组件的样式 | |||||
| > 3. 去除抛物线的点位认证 | |||||
| > 2. 去除抛物线的点位认证 | |||||
| > 3. 完善场景组件禁用功能 | |||||
| > 4. 修改面积函数的无法使用的问题 | |||||
| ### 1.13.3 - 2020-12-26 | ### 1.13.3 - 2020-12-26 | ||||
| }) | }) | ||||
| } | } | ||||
| /** | |||||
| * | |||||
| * @private | |||||
| */ | |||||
| _bindEvent() { | |||||
| this._viewer.scene.imagerySplitPosition = 0.5 | |||||
| this._wrapper.style.left = '50%' | |||||
| } | |||||
| /** | |||||
| * | |||||
| * @private | |||||
| */ | |||||
| _unbindEvent() { | |||||
| if (this._baseLayer) { | |||||
| this._viewer.scene.imagerySplitPosition = | |||||
| this._baseLayer.splitDirection > 0 ? 1 : 0 | |||||
| } else { | |||||
| this._viewer.scene.imagerySplitPosition = 0 | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private | ||||
| this._ready = true | this._ready = true | ||||
| } | } | ||||
| /** | |||||
| * | |||||
| * @param movement | |||||
| * @private | |||||
| */ | |||||
| _moveHandler(movement) { | _moveHandler(movement) { | ||||
| if (!this._moveActive || !this._enable) { | if (!this._moveActive || !this._enable) { | ||||
| return | return | ||||
| this._viewer.scene.imagerySplitPosition = splitPosition | this._viewer.scene.imagerySplitPosition = splitPosition | ||||
| } | } | ||||
| addBaseLayer(baseLayer, splitDirection) { | |||||
| /** | |||||
| * | |||||
| * @param baseLayer | |||||
| * @param splitDirection | |||||
| * @returns {MapSplit} | |||||
| */ | |||||
| addBaseLayer(baseLayer, splitDirection = 1) { | |||||
| if (!this._viewer || !this._enable) { | if (!this._viewer || !this._enable) { | ||||
| return this | return this | ||||
| } | } | ||||
| if (baseLayer) { | if (baseLayer) { | ||||
| if (this._baseLayer) { | |||||
| this._viewer.delegate.imageryLayers.remove(this._baseLayer) | |||||
| } | |||||
| this._baseLayer = this._viewer.delegate.imageryLayers.addImageryProvider( | |||||
| baseLayer | |||||
| ) | |||||
| this._baseLayer && this._viewer.imageryLayers.remove(this._baseLayer) | |||||
| this._baseLayer = this._viewer.imageryLayers.addImageryProvider(baseLayer) | |||||
| this._baseLayer.splitDirection = splitDirection || 0 | this._baseLayer.splitDirection = splitDirection || 0 | ||||
| this._viewer.scene.imagerySplitPosition = | this._viewer.scene.imagerySplitPosition = | ||||
| this._wrapper.offsetLeft / this._wrapper.parentElement.offsetWidth | this._wrapper.offsetLeft / this._wrapper.parentElement.offsetWidth |
| * | * | ||||
| */ | */ | ||||
| showAt(position, content) { | showAt(position, content) { | ||||
| if (position) { | |||||
| this._updateWindowCoord(position) | |||||
| if (!this._enable) { | |||||
| return this | |||||
| } | } | ||||
| position && this._updateWindowCoord(position) | |||||
| this.setContent(content) | this.setContent(content) | ||||
| return this | return this | ||||
| } | } |
| } | } | ||||
| set enable(enable) { | set enable(enable) { | ||||
| if (this._enable === enable) { | |||||
| return this | |||||
| } | |||||
| this._enable = enable | this._enable = enable | ||||
| this._state = this._enable ? State.ENABLED : State.DISABLED | this._state = this._enable ? State.ENABLED : State.DISABLED | ||||
| this._enableHook && this._enableHook() | this._enableHook && this._enableHook() | ||||
| return this | |||||
| } | } | ||||
| get enable() { | get enable() { | ||||
| * @private | * @private | ||||
| */ | */ | ||||
| _enableHook() { | _enableHook() { | ||||
| !this._wrapper.parentNode && | |||||
| this._viewer && | |||||
| this._viewer.dcContainer.appendChild(this._wrapper) | |||||
| this._wrapper && | |||||
| (this._wrapper.style.visibility = this._enable ? 'visible' : 'hidden') | |||||
| !this._ready && this._mountContent() | !this._ready && this._mountContent() | ||||
| this._enable ? this._bindEvent() : this._unbindEvent() | |||||
| if (this._enable) { | |||||
| !this._wrapper.parentNode && | |||||
| this._viewer.dcContainer.appendChild(this._wrapper) | |||||
| this._bindEvent() | |||||
| } else { | |||||
| this._unbindEvent() | |||||
| this._wrapper.parentNode && | |||||
| this._viewer.dcContainer.removeChild(this._wrapper) | |||||
| } | |||||
| } | } | ||||
| /** | /** |
| width: 5px; | width: 5px; | ||||
| height: 100%; | height: 100%; | ||||
| z-index: 9999; | z-index: 9999; | ||||
| visibility: hidden; | |||||
| .splitter { | .splitter { | ||||
| position: absolute; | position: absolute; | ||||
| left: -21px; | left: -21px; |