解决二三维快速切换贴地svg显隐报错的问题
This commit is contained in:
@ -108,13 +108,19 @@ class GroundSvg extends Base {
|
|||||||
this._isdrag = false
|
this._isdrag = false
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
|
|
||||||
|
if(this.sdk.entityMap.get(this.options.id)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.sdk.addIncetance(this.options.id, this)
|
this.sdk.addIncetance(this.options.id, this)
|
||||||
this.picking = true
|
this.picking = true
|
||||||
|
|
||||||
|
|
||||||
if (this.options.show) {
|
if (this.options.show) {
|
||||||
setSplitDirection(0, this.options.id)
|
setSplitDirection(0, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._entityArray = []
|
||||||
|
|
||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,8 +163,6 @@ class GroundSvg extends Base {
|
|||||||
if (this.options.text && this.options.text.show && this.text) {
|
if (this.options.text && this.options.text.show && this.text) {
|
||||||
this.text.show = v
|
this.text.show = v
|
||||||
}
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
|
||||||
syncSplitData(this.sdk, this.options.id)
|
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -820,8 +824,13 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
for (let i = 0; i < this.hierarchys.length; i++) {
|
for (let i = 0; i < this.hierarchys.length; i++) {
|
||||||
for (let m = 0; m < this.hierarchys[i].length; m++) {
|
for (let m = 0; m < this.hierarchys[i].length; m++) {
|
||||||
|
let id = this.options.id + `-${i}_${m}}`
|
||||||
|
let oldEntity = this.sdk.viewer.entities.getById(id)
|
||||||
|
if(oldEntity) {
|
||||||
|
this.sdk.viewer.entities.remove(oldEntity)
|
||||||
|
}
|
||||||
let entity = this.sdk.viewer.entities.add({
|
let entity = this.sdk.viewer.entities.add({
|
||||||
id: this.options.id + `-${i}_${m}`,
|
id: this.options.id + `-${i}_${m}}`,
|
||||||
show: this.options.show,
|
show: this.options.show,
|
||||||
polygon: {
|
polygon: {
|
||||||
hierarchy: new Cesium.CallbackProperty(() => {
|
hierarchy: new Cesium.CallbackProperty(() => {
|
||||||
@ -854,6 +863,7 @@ class GroundSvg extends Base {
|
|||||||
color: this.geojson.features[i].properties.color
|
color: this.geojson.features[i].properties.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this._entityArray.push(entity)
|
||||||
this.entity.add(entity)
|
this.entity.add(entity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1991,6 +2001,8 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async remove() {
|
async remove() {
|
||||||
|
this._worker.onmessage = (event) => {}
|
||||||
|
await this.sdk.removeIncetance(this.options.id)
|
||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2000,12 +2012,11 @@ class GroundSvg extends Base {
|
|||||||
for (let i = this.entity.values.length; i >= 0; i--) {
|
for (let i = this.entity.values.length; i >= 0; i--) {
|
||||||
this.sdk.viewer.entities.remove(this.entity.values[i])
|
this.sdk.viewer.entities.remove(this.entity.values[i])
|
||||||
}
|
}
|
||||||
this.entity = null
|
|
||||||
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this._DialogObject = null
|
this._DialogObject = null
|
||||||
}
|
}
|
||||||
await this.sdk.removeIncetance(this.options.id)
|
|
||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,11 @@ class LabelObject extends Base {
|
|||||||
}
|
}
|
||||||
this.originalOptions = copyObj(this.options)
|
this.originalOptions = copyObj(this.options)
|
||||||
|
|
||||||
|
let id = this.options.id + '-label'
|
||||||
|
let oldEntity = this.sdk.viewer.entities.getById(id)
|
||||||
|
if(oldEntity) {
|
||||||
|
this.sdk.viewer.entities.remove(oldEntity)
|
||||||
|
}
|
||||||
this.entity = this.sdk.viewer.entities.add({
|
this.entity = this.sdk.viewer.entities.add({
|
||||||
show: this.options.show,
|
show: this.options.show,
|
||||||
id: this.options.id + '-label',
|
id: this.options.id + '-label',
|
||||||
|
@ -13,6 +13,7 @@ import MouseTip from '../../../MouseTip'
|
|||||||
import Controller from '../../../Controller/index'
|
import Controller from '../../../Controller/index'
|
||||||
import { syncData } from '../../../Global/MultiViewportMode'
|
import { syncData } from '../../../Global/MultiViewportMode'
|
||||||
import { legp } from '../../Element/datalist'
|
import { legp } from '../../Element/datalist'
|
||||||
|
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
|
||||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ class PolylineObject extends Base {
|
|||||||
options.label.fontSize || options.label.fontSize === 0
|
options.label.fontSize || options.label.fontSize === 0
|
||||||
? options.label.fontSize
|
? options.label.fontSize
|
||||||
: 20,
|
: 20,
|
||||||
|
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
|
||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth:
|
lineWidth:
|
||||||
options.label.lineWidth || options.label.lineWidth === 0
|
options.label.lineWidth || options.label.lineWidth === 0
|
||||||
@ -693,6 +695,21 @@ class PolylineObject extends Base {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get labelFontFamily() {
|
||||||
|
return this.options.label.fontFamily
|
||||||
|
}
|
||||||
|
|
||||||
|
set labelFontFamily(v) {
|
||||||
|
this.options.label.fontFamily = v || 0
|
||||||
|
this.label && (this.label.fontFamily = this.options.label.fontFamily)
|
||||||
|
|
||||||
|
let name = getFontFamilyName(this.labelFontFamily) || ''
|
||||||
|
this._elms.labelFontFamily &&
|
||||||
|
this._elms.labelFontFamily.forEach(item => {
|
||||||
|
item.value = name
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
get labelColor() {
|
get labelColor() {
|
||||||
return this.options.label.color
|
return this.options.label.color
|
||||||
}
|
}
|
||||||
@ -1289,6 +1306,7 @@ class PolylineObject extends Base {
|
|||||||
],
|
],
|
||||||
text: that.options.name,
|
text: that.options.name,
|
||||||
fontSize: that.options.label.fontSize,
|
fontSize: that.options.label.fontSize,
|
||||||
|
fontFamily: that.options.label.fontFamily,
|
||||||
color: that.options.label.color,
|
color: that.options.label.color,
|
||||||
pixelOffset: that.options.label.pixelOffset,
|
pixelOffset: that.options.label.pixelOffset,
|
||||||
backgroundColor: that.options.label.backgroundColor,
|
backgroundColor: that.options.label.backgroundColor,
|
||||||
@ -2147,6 +2165,37 @@ class PolylineObject extends Base {
|
|||||||
this._elms.altInput.push(altInput)
|
this._elms.altInput.push(altInput)
|
||||||
tBodyElm.appendChild(tr)
|
tBodyElm.appendChild(tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let fontData = getFontList()
|
||||||
|
let fontObject = legp(
|
||||||
|
this._DialogObject._element.content.getElementsByClassName(
|
||||||
|
'font-select-box'
|
||||||
|
)[0],
|
||||||
|
'.font-select'
|
||||||
|
)
|
||||||
|
if (fontObject) {
|
||||||
|
fontObject.legp_search(fontData)
|
||||||
|
let fontDataLegpElm = this._DialogObject._element.content
|
||||||
|
.getElementsByClassName('font-select')[0]
|
||||||
|
.getElementsByTagName('input')[0]
|
||||||
|
fontDataLegpElm.value = fontData[this.labelFontFamily].value
|
||||||
|
for (let i = 0; i < fontData.length; i++) {
|
||||||
|
if (fontData[i].value == fontDataLegpElm.value) {
|
||||||
|
fontObject.legp_searchActive(fontData[i].value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fontDataLegpElm.addEventListener('input', () => {
|
||||||
|
for (let i = 0; i < fontData.length; i++) {
|
||||||
|
if (fontData[i].value === fontDataLegpElm.value) {
|
||||||
|
this.labelFontFamily = fontData[i].key
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this._elms.labelFontFamily = [fontDataLegpElm]
|
||||||
|
}
|
||||||
}, 0)
|
}, 0)
|
||||||
} else {
|
} else {
|
||||||
if (this._DialogObject && this._DialogObject.close) {
|
if (this._DialogObject && this._DialogObject.close) {
|
||||||
@ -2348,6 +2397,7 @@ class PolylineObject extends Base {
|
|||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
this.labelColor = this.originalOptions.label.color
|
this.labelColor = this.originalOptions.label.color
|
||||||
this.labelFontSize = this.originalOptions.label.fontSize
|
this.labelFontSize = this.originalOptions.label.fontSize
|
||||||
|
this.labelFontFamily = this.originalOptions.label.fontFamily
|
||||||
this.labelLineWidth = this.originalOptions.label.lineWidth
|
this.labelLineWidth = this.originalOptions.label.lineWidth
|
||||||
this.labelPixelOffset = this.originalOptions.label.pixelOffset
|
this.labelPixelOffset = this.originalOptions.label.pixelOffset
|
||||||
this.labelLineColor = this.originalOptions.label.lineColor
|
this.labelLineColor = this.originalOptions.label.lineColor
|
||||||
|
@ -86,6 +86,13 @@ class YJColorPicker {
|
|||||||
let pickPen = document.createElement('div')
|
let pickPen = document.createElement('div')
|
||||||
pickPen.className = 'icon-pen-box'
|
pickPen.className = 'icon-pen-box'
|
||||||
pickPen.innerHTML = '<svg class="icon-pen"><use xlink:href="#yj-icon-pen"></use></svg>'
|
pickPen.innerHTML = '<svg class="icon-pen"><use xlink:href="#yj-icon-pen"></use></svg>'
|
||||||
|
|
||||||
|
/** 为完成、暂时隐藏 *///////
|
||||||
|
pickPen.style.opacity = '0'
|
||||||
|
pickPen.style.cursor = 'unset'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let pickerInput = _this.colorPicker.pickerInput
|
let pickerInput = _this.colorPicker.pickerInput
|
||||||
pickerInput.parentNode.insertBefore(pickPen, pickerInput)
|
pickerInput.parentNode.insertBefore(pickPen, pickerInput)
|
||||||
pickerInput.style.width = '188px'
|
pickerInput.style.width = '188px'
|
||||||
|
@ -1058,7 +1058,6 @@
|
|||||||
.YJ-custom-base-dialog .ew-color-picker .icon-pen-box {
|
.YJ-custom-base-dialog .ew-color-picker .icon-pen-box {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
/* cursor: pointer; */
|
/* cursor: pointer; */
|
||||||
cursor: no-drop;
|
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -1132,6 +1131,7 @@
|
|||||||
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.subtract {
|
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.subtract {
|
||||||
border-color: rgba(var(--color-sdk-base-rgb), 0.2);
|
border-color: rgba(var(--color-sdk-base-rgb), 0.2);
|
||||||
background: unset;
|
background: unset;
|
||||||
|
line-height: 22px;
|
||||||
}
|
}
|
||||||
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.add:hover,
|
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.add:hover,
|
||||||
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.subtract:hover {
|
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.subtract:hover {
|
||||||
|
Reference in New Issue
Block a user