Browse Source

完善场景组件禁用功能

tags/1.14.0
Caven Chen 4 years ago
parent
commit
ffa6305cb8

+ 3
- 2
CHANGES.md View File

@@ -3,8 +3,9 @@
### 1.14.0 - 2021-01-09

> 1. 升级 Cesium 到 1.77.0
> 2. 完善罗盘组件的样式
> 3. 去除抛物线的点位认证
> 2. 去除抛物线的点位认证
> 3. 完善场景组件禁用功能
> 4. 修改面积函数的无法使用的问题

### 1.13.3 - 2020-12-26


+ 1
- 1
dist/dc.base.min.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/dc.core.min.css
File diff suppressed because it is too large
View File


+ 1
- 1
dist/dc.core.min.js
File diff suppressed because it is too large
View File


+ 36
- 7
src/core/widget/MapSplit.js View File

@@ -31,6 +31,28 @@ class MapSplit extends Widget {
})
}

/**
*
* @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
@@ -64,6 +86,11 @@ class MapSplit extends Widget {
this._ready = true
}

/**
*
* @param movement
* @private
*/
_moveHandler(movement) {
if (!this._moveActive || !this._enable) {
return
@@ -76,17 +103,19 @@ class MapSplit extends Widget {
this._viewer.scene.imagerySplitPosition = splitPosition
}

addBaseLayer(baseLayer, splitDirection) {
/**
*
* @param baseLayer
* @param splitDirection
* @returns {MapSplit}
*/
addBaseLayer(baseLayer, splitDirection = 1) {
if (!this._viewer || !this._enable) {
return this
}
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._viewer.scene.imagerySplitPosition =
this._wrapper.offsetLeft / this._wrapper.parentElement.offsetWidth

+ 4
- 2
src/core/widget/Tooltip.js View File

@@ -49,9 +49,11 @@ class Tooltip extends Widget {
*
*/
showAt(position, content) {
if (position) {
this._updateWindowCoord(position)
if (!this._enable) {
return this
}

position && this._updateWindowCoord(position)
this.setContent(content)
return this
}

+ 13
- 6
src/core/widget/Widget.js View File

@@ -16,9 +16,13 @@ class Widget {
}

set enable(enable) {
if (this._enable === enable) {
return this
}
this._enable = enable
this._state = this._enable ? State.ENABLED : State.DISABLED
this._enableHook && this._enableHook()
return this
}

get enable() {
@@ -52,13 +56,16 @@ class Widget {
* @private
*/
_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._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)
}
}

/**

+ 0
- 1
src/themes/mapsplit.scss View File

@@ -6,7 +6,6 @@
width: 5px;
height: 100%;
z-index: 9999;
visibility: hidden;
.splitter {
position: absolute;
left: -21px;

Loading…
Cancel
Save