合并
This commit is contained in:
@ -12,7 +12,7 @@ import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
|
||||
import MouseTip from '../../../MouseTip'
|
||||
import CircleDiffuseMaterialProperty from '../../Materail/CircleRippleMaterialProperty'
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||
|
||||
class CircleDiffuse extends Base {
|
||||
/**
|
||||
@ -67,7 +67,7 @@ class CircleDiffuse extends Base {
|
||||
super(sdk, options);
|
||||
this.options.lng = options.lng
|
||||
this.options.lat = options.lat
|
||||
this.options.color = options.color || '#1FA8E3'
|
||||
this.options.color = options.color || '#ff0000'
|
||||
this.options.transparency = (options.transparency || options.transparency === 0) ? options.transparency : 1
|
||||
if (this.options.transparency > 1) {
|
||||
this.options.transparency = 1
|
||||
@ -86,7 +86,7 @@ class CircleDiffuse extends Base {
|
||||
|
||||
this.options.circle = options.circle || [{ radius: 10 }]
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
if(this.options.circle[i].radius>999999) {
|
||||
if (this.options.circle[i].radius > 999999) {
|
||||
this.options.circle[i].radius = 999999
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,6 @@ class CircleDiffuse extends Base {
|
||||
options.label = options.label || {}
|
||||
this._elms = {};
|
||||
this.options.label = {
|
||||
text: this.options.name,
|
||||
show: options.label.show || false,
|
||||
position: options.label.position,
|
||||
fontSize: (options.label.fontSize || options.label.fontSize === 0) ? options.label.fontSize : 20,
|
||||
@ -114,17 +113,12 @@ class CircleDiffuse extends Base {
|
||||
this.options.instruct = options.instruct || ''
|
||||
this.options.operatingPoint = options.operatingPoint || ''
|
||||
this.options.attribute = options.attribute || {}
|
||||
this.options.attribute.vr = this.options.attribute.vr || {}
|
||||
this.options.attribute.vr.content = this.options.attribute.vr.content || []
|
||||
this.options.attribute.link = this.options.attribute.link || {}
|
||||
this.options.attribute.link.content = this.options.attribute.link.content || []
|
||||
this.options.attribute.camera = this.options.attribute.camera || {}
|
||||
this.options.attribute.camera.content = this.options.attribute.camera.content || []
|
||||
this.options.attribute.ISC = this.options.attribute.ISC || {}
|
||||
this.options.attribute.ISC.content = this.options.attribute.ISC.content || []
|
||||
this.options.attribute.goods = this.options.attribute.goods || {}
|
||||
this.options.attribute.goods.content = this.options.attribute.goods.content || []
|
||||
this.options.attributeType = options.attributeType || 'richText'
|
||||
|
||||
delete this.options.attribute.camera
|
||||
delete this.options.attribute.vr
|
||||
delete this.options.attribute.goods
|
||||
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
@ -258,9 +252,9 @@ class CircleDiffuse extends Base {
|
||||
this.options.show = v
|
||||
}
|
||||
if (!this.showView || this.showView == 3 || !sdkD) {
|
||||
this.entity.show = this.options.show
|
||||
this.entity.show = this.options.show
|
||||
if (this.options.label.show) {
|
||||
this.label.show = this.options.show
|
||||
this.label.show = this.options.show
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -271,13 +265,13 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
|
||||
this.isShowView = false
|
||||
|
||||
|
||||
syncData(this.sdk, this.options.id)
|
||||
syncSplitData(this.sdk, this.options.id)
|
||||
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||
this._DialogObject.showBtn.checked = v
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.error("参数必须为boolean")
|
||||
}
|
||||
@ -356,8 +350,7 @@ class CircleDiffuse extends Base {
|
||||
setTimeout(() => {
|
||||
this.picking = true
|
||||
}, 500);
|
||||
if(this.label && this.label.entity && this.label.entity.billboard)
|
||||
{
|
||||
if (this.label && this.label.entity && this.label.entity.billboard) {
|
||||
this.label.entity.billboard.color = Cesium.Color.fromCssColorString(`rgba(255,255,255,1)`)
|
||||
}
|
||||
if (this.event) {
|
||||
@ -407,14 +400,18 @@ class CircleDiffuse extends Base {
|
||||
return this.options.circle
|
||||
}
|
||||
set circle(v) {
|
||||
console.log(v)
|
||||
this.options.circle = v || [{ radius: 10 }]
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
if(this.options.circle[i].radius>999999) {
|
||||
if (Number(this.options.circle[i].radius) > 999999) {
|
||||
this.options.circle[i].radius = 999999
|
||||
}
|
||||
if (Number(this.options.circle[i].radius) > radius) {
|
||||
radius = Number(this.options.circle[i].radius)
|
||||
}
|
||||
}
|
||||
this._createCircleElm()
|
||||
this._radius = radius
|
||||
CircleDiffuse.create(this)
|
||||
}
|
||||
|
||||
get speed() {
|
||||
@ -672,352 +669,10 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
get instruct() {
|
||||
return this.options.instruct
|
||||
}
|
||||
set instruct(v) {
|
||||
this.options.instruct = v
|
||||
this._elms.instruct && this._elms.instruct.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
}
|
||||
|
||||
get operatingPoint() {
|
||||
return this.options.operatingPoint
|
||||
}
|
||||
set operatingPoint(v) {
|
||||
this.options.operatingPoint = v
|
||||
this._elms.operatingPoint && this._elms.operatingPoint.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
}
|
||||
|
||||
get attributeType() {
|
||||
return this.options.attributeType
|
||||
}
|
||||
|
||||
set attributeType(v) {
|
||||
this.options.attributeType = v
|
||||
this._elms.attributeType && this._elms.attributeType.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
let attributeContent = this._DialogObject._element.content.getElementsByClassName('attribute-content')
|
||||
for (let i = 0; i < attributeContent.length; i++) {
|
||||
if (attributeContent[i].className.indexOf('attribute-content-' + v) > -1) {
|
||||
attributeContent[i].style.display = 'block';
|
||||
}
|
||||
else {
|
||||
attributeContent[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get attributeLink() {
|
||||
return this.options.attribute.link.content
|
||||
}
|
||||
|
||||
set attributeLink(v) {
|
||||
this.options.attribute.link.content = v
|
||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-link').length == 0) {
|
||||
return
|
||||
}
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
tableContent.innerHTML = ''
|
||||
if (this.options.attribute.link.content.length > 0) {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
||||
}
|
||||
else {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
||||
}
|
||||
for (let i = 0; i < this.options.attribute.link.content.length; i++) {
|
||||
let tr = `
|
||||
<div class="tr">
|
||||
<div class="td">` + this.options.attribute.link.content[i].name + `</div>
|
||||
<div class="td">` + this.options.attribute.link.content[i].url + `</div>
|
||||
<div class="td">
|
||||
<button @click="linkEdit">编辑</button>
|
||||
<button @click="linkDelete">删除</button>
|
||||
</div>
|
||||
</div>`
|
||||
let trElm = document.createRange().createContextualFragment(tr)
|
||||
tableContent.appendChild(trElm)
|
||||
}
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
let fun = {
|
||||
linkEdit: async (index) => {
|
||||
this.attributeLink = await this.options.attribute.link.content
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-link')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
if (index === i) {
|
||||
let height = item[i].offsetHeight
|
||||
let html = `
|
||||
<div class="td">
|
||||
<input class="input" type="text">
|
||||
</div>
|
||||
<div class="td">
|
||||
<textarea class="input link-edit" type="text"></textarea>
|
||||
</div>
|
||||
<div class="td">
|
||||
<button @click="confirmEdit">确认</button>
|
||||
<button @click="cancelEdit">取消</button>
|
||||
</div>`
|
||||
item[i].innerHTML = html
|
||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
||||
textareaElm.style.height = (height - 10) + 'px'
|
||||
let td = item[i].getElementsByClassName('td')
|
||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].name
|
||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.link.content[index].url
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] || !btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
linkDelete: (i) => {
|
||||
this.options.attribute.link.content.splice(i, 1)
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
},
|
||||
|
||||
confirmEdit: (value, i) => {
|
||||
let name = value.name && value.name.replace(/\s/g, "")
|
||||
let url = value.url && value.url.replace(/\s/g, "")
|
||||
if (name && url) {
|
||||
this.options.attribute.link.content[i] = value
|
||||
}
|
||||
else {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '名称或链接不能为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
},
|
||||
cancelEdit: () => {
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
},
|
||||
fileSelect: (value, i) => {
|
||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
||||
fileElm.click()
|
||||
fileElm.removeEventListener('change', fileSelect)
|
||||
fileElm.addEventListener('change', fileSelect)
|
||||
}
|
||||
}
|
||||
let fileSelect = (event) => {
|
||||
if (event.target.value) {
|
||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
||||
event.target.value = null
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] ||!btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value](i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
get attributeCamera() {
|
||||
return this.options.attribute.camera.content
|
||||
}
|
||||
|
||||
set attributeCamera(v) {
|
||||
this.options.attribute.camera.content = v
|
||||
}
|
||||
|
||||
get attributeISC() {
|
||||
return this.options.attribute.ISC.content
|
||||
}
|
||||
|
||||
set attributeISC(v) {
|
||||
this.options.attribute.ISC.content = v
|
||||
}
|
||||
|
||||
get attributeVr() {
|
||||
return this.options.attribute.vr.content
|
||||
}
|
||||
|
||||
set attributeVr(v) {
|
||||
this.options.attribute.vr.content = v
|
||||
if (!this._DialogObject || !this._DialogObject._element || !this._DialogObject._element.content || this._DialogObject._element.content.getElementsByClassName('attribute-content-vr').length == 0) {
|
||||
return
|
||||
}
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
tableContent.innerHTML = ''
|
||||
if (this.options.attribute.vr.content.length > 0) {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'none'
|
||||
}
|
||||
else {
|
||||
table.getElementsByClassName('table-empty')[0].style.display = 'flex'
|
||||
}
|
||||
for (let i = 0; i < this.options.attribute.vr.content.length; i++) {
|
||||
let tr = `
|
||||
<div class="tr">
|
||||
<div class="td">` + this.options.attribute.vr.content[i].name + `</div>
|
||||
<div class="td">` + this.options.attribute.vr.content[i].url + `</div>
|
||||
<div class="td">
|
||||
<button @click="vrEdit">编辑</button>
|
||||
<button @click="vrDelete">删除</button>
|
||||
</div>
|
||||
</div>`
|
||||
let trElm = document.createRange().createContextualFragment(tr)
|
||||
tableContent.appendChild(trElm)
|
||||
}
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
let fun = {
|
||||
vrEdit: async (index) => {
|
||||
this.attributeVr = await this.options.attribute.vr.content
|
||||
let table = this._DialogObject._element.content.getElementsByClassName('attribute-content-vr')[1].getElementsByClassName('table')[0]
|
||||
let tableContent = table.getElementsByClassName('table-body')[0]
|
||||
let item = tableContent.getElementsByClassName('tr')
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
if (index === i) {
|
||||
let height = item[i].offsetHeight
|
||||
let html = `
|
||||
<div class="td">
|
||||
<input class="input" type="text">
|
||||
</div>
|
||||
<div class="td">
|
||||
<textarea class="input link-edit" type="text"></textarea>
|
||||
</div>
|
||||
<div class="td">
|
||||
<button @click="confirmEdit">确认</button>
|
||||
<button @click="cancelEdit">取消</button>
|
||||
</div>`
|
||||
item[i].innerHTML = html
|
||||
let textareaElm = item[i].getElementsByClassName('link-edit')[0]
|
||||
textareaElm.style.height = (height - 10) + 'px'
|
||||
let td = item[i].getElementsByClassName('td')
|
||||
td[0].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].name
|
||||
td[1].getElementsByClassName('input')[0].value = this.options.attribute.vr.content[index].url
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] ||!btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value]({ name: td[0].getElementsByClassName('input')[0].value, url: td[1].getElementsByClassName('input')[0].value }, i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
vrDelete: (i) => {
|
||||
this.options.attribute.vr.content.splice(i, 1)
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
},
|
||||
|
||||
confirmEdit: (value, i) => {
|
||||
let name = value.name && value.name.replace(/\s/g, "")
|
||||
let url = value.url && value.url.replace(/\s/g, "")
|
||||
if (name && url) {
|
||||
this.options.attribute.vr.content[i] = value
|
||||
}
|
||||
else {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '名称或链接不能为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
},
|
||||
cancelEdit: () => {
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
},
|
||||
fileSelect: (value, i) => {
|
||||
let fileElm = item[i].getElementsByClassName('file-select')[0]
|
||||
fileElm.click()
|
||||
fileElm.removeEventListener('change', fileSelect)
|
||||
fileElm.addEventListener('change', fileSelect)
|
||||
}
|
||||
}
|
||||
let fileSelect = (event) => {
|
||||
if (event.target.value) {
|
||||
let td = item[event.target.getAttribute('index')].getElementsByClassName('td')
|
||||
td[1].getElementsByClassName('input')[0].value = event.target.value
|
||||
event.target.value = null
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < item.length; i++) {
|
||||
let btn = item[i].getElementsByTagName('button')
|
||||
for (let n = 0; n < btn.length; n++) {
|
||||
if (!btn[n] ||!btn[n].attributes) {
|
||||
continue
|
||||
}
|
||||
for (let m of btn[n].attributes) {
|
||||
if (m.name === '@click') {
|
||||
btn[n].addEventListener('click', (e) => {
|
||||
if (typeof (fun[m.value]) === 'function') {
|
||||
fun[m.value](i)
|
||||
}
|
||||
});
|
||||
btn[n].attributes.removeNamedItem(m.name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get attributeGoods() {
|
||||
return this.options.attribute.goods.content
|
||||
}
|
||||
|
||||
set attributeGoods(v) {
|
||||
this.options.attribute.goods.content = v
|
||||
}
|
||||
|
||||
async flyTo(options = {}) {
|
||||
setActiveViewer(0)
|
||||
closeRotateAround(this.sdk)
|
||||
closeViewFollow(this.sdk)
|
||||
closeViewFollow(this.sdk)
|
||||
|
||||
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
||||
let orientation = {
|
||||
@ -1084,6 +739,7 @@ class CircleDiffuse extends Base {
|
||||
|
||||
// 编辑框
|
||||
async edit(state) {
|
||||
return
|
||||
let _this = this
|
||||
this.originalOptions = this.deepCopyObj(this.options)
|
||||
|
||||
@ -1340,13 +996,6 @@ class CircleDiffuse extends Base {
|
||||
this.labelBackgroundColorEnd = this.originalOptions.label.backgroundColor[1]
|
||||
this.instruct = this.originalOptions.instruct
|
||||
this.operatingPoint = this.originalOptions.operatingPoint
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
this.attributeCamera = this.options.attribute.camera.content
|
||||
this.attributeGoods = this.options.attribute.goods.content
|
||||
this.attributeISC = this.options.attribute.ISC.content
|
||||
this.cameraSelect && this.cameraSelect()
|
||||
this.goodsSelect && this.goodsSelect()
|
||||
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
@ -1374,224 +1023,6 @@ class CircleDiffuse extends Base {
|
||||
await syncData(this.sdk, this.options.id)
|
||||
}
|
||||
|
||||
instructSubmit() {
|
||||
this.Dialog.instructSubmit && this.Dialog.instructSubmit(this.options.id, this.options.label.text, this.instruct)
|
||||
this.originalOptions.instruct = this.instruct
|
||||
}
|
||||
|
||||
operatingPointSubmit() {
|
||||
this.Dialog.operatingPointSubmit && this.Dialog.operatingPointSubmit(this.options.id, this.options.label.text, this.operatingPoint)
|
||||
this.originalOptions.operatingPoint = this.operatingPoint
|
||||
}
|
||||
|
||||
_createCircleElm() {
|
||||
if (this._DialogObject && this._DialogObject._element && this._DialogObject._element.content) {
|
||||
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-radius-unit')[0].getElementsByTagName('input')[0]
|
||||
let unit = unitDataLegpElm ? unitDataLegpElm.value : '米'
|
||||
let circleContentElm = this._DialogObject._element.content.getElementsByClassName('circle-content-box')[0]
|
||||
circleContentElm.innerHTML = ''
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
let circleElm = document.createElement('div');
|
||||
circleElm.className = 'row'
|
||||
let addString = ''
|
||||
let deleteString = '<button class="circle-minus"><svg class="icon-minus"><use xlink:href="#yj-icon-minus"></use></svg></button>'
|
||||
if (i === 0 && i === this.options.circle.length - 1) {
|
||||
deleteString = ''
|
||||
}
|
||||
if (i === this.options.circle.length - 1) {
|
||||
addString = `<button class="circle-add" style="margin-left: 5px;"><svg class="icon-add2"><use xlink:href="#yj-icon-add2"></use></svg></button>`
|
||||
}
|
||||
circleElm.innerHTML = `
|
||||
<div class="col">
|
||||
<span class="label">半径</span>
|
||||
<div class="input-number input-number-unit-1">
|
||||
<input class="input" type="number" title="" min="0" max="999999" style="width: 130px;">
|
||||
<span class="unit">${unit === '米' ? 'm' : 'km'}</span>
|
||||
<span class="arrow"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex-direction: row-reverse;">
|
||||
<div class="color"></div>
|
||||
<span class="label">扩散颜色</span>
|
||||
</div>
|
||||
<div class="col" style="flex-direction: row-reverse;">
|
||||
${addString}
|
||||
${deleteString}
|
||||
</div>
|
||||
`
|
||||
let inputElm = circleElm.getElementsByClassName('input')[0]
|
||||
inputElm.value = this.options.circle[i].radius / (unit === '米' ? 1 : 1000)
|
||||
inputElm.addEventListener('input', (e) => {
|
||||
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-radius-unit')[0].getElementsByTagName('input')[0]
|
||||
let unit = unitDataLegpElm.value
|
||||
if (e.target.value || e.target.value === 0) {
|
||||
let value = e.target.value
|
||||
value = Number(value)
|
||||
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
||||
if (((!e.target.max) && (!e.target.min)) || ((value <= (Number(e.target.max) / (unit === '米' ? 1 : 1000))) && value >= Number(e.target.min))) {
|
||||
if (unit === '米') {
|
||||
value = Math.floor(value * 100) / 100
|
||||
}
|
||||
else {
|
||||
value = Math.floor(value * 100000) / 100000
|
||||
}
|
||||
this.options.circle[i].radius = value * (unit === '米' ? 1 : 1000)
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
if (Number(this.options.circle[i].radius) > radius) {
|
||||
radius = Number(this.options.circle[i].radius)
|
||||
}
|
||||
}
|
||||
this._radius = radius
|
||||
// inputElm.value = value
|
||||
CircleDiffuse.create(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
inputElm.addEventListener('blur', (e) => {
|
||||
let unitDataLegpElm = this._DialogObject._element.content.getElementsByClassName('input-radius-unit')[0].getElementsByTagName('input')[0]
|
||||
let unit = unitDataLegpElm.value
|
||||
if (e.target.value || e.target.value === 0) {
|
||||
let value = e.target.value
|
||||
value = Number(value)
|
||||
if ((e.target.max) && value > (Number(e.target.max) / (unit === '米' ? 1 : 1000))) {
|
||||
value = (Number(e.target.max) / (unit === '米' ? 1 : 1000))
|
||||
}
|
||||
if ((e.target.min) && value < Number(e.target.min)) {
|
||||
value = Number(e.target.min)
|
||||
}
|
||||
if (unit === '米') {
|
||||
value = Math.floor(value * 100) / 100
|
||||
}
|
||||
else {
|
||||
value = Math.floor(value * 100000) / 100000
|
||||
}
|
||||
this.options.circle[i].radius = value * (unit === '米' ? 1 : 1000)
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
if (Number(this.options.circle[i].radius) > radius) {
|
||||
radius = Number(this.options.circle[i].radius)
|
||||
}
|
||||
}
|
||||
this._radius = radius
|
||||
inputElm.value = value
|
||||
CircleDiffuse.create(this)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
// 颜色组件
|
||||
let colorPicker = new YJColorPicker({
|
||||
el: circleElm.getElementsByClassName("color")[0],
|
||||
size: 'mini',//颜色box类型
|
||||
alpha: false,//是否开启透明度
|
||||
defaultColor: this.options.circle[i].color || this.options.color,
|
||||
disabled: false,//是否禁止打开颜色选择器
|
||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||
sure: (color) => {
|
||||
this.options.circle[i].color = color
|
||||
CircleDiffuse.create(this)
|
||||
},//点击确认按钮事件回调
|
||||
clear: () => {
|
||||
this.options.circle[i].color = 'rgba(255,255,255,1)'
|
||||
CircleDiffuse.create(this)
|
||||
},//点击清空按钮事件回调
|
||||
})
|
||||
// 减
|
||||
let minusElm = circleElm.getElementsByClassName('circle-minus')[0]
|
||||
minusElm && minusElm.addEventListener('click', () => {
|
||||
this.options.circle.splice(i, 1)
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
if (Number(this.options.circle[i].radius) > radius) {
|
||||
radius = Number(this.options.circle[i].radius)
|
||||
}
|
||||
}
|
||||
this._radius = radius
|
||||
CircleDiffuse.create(this)
|
||||
this._createCircleElm()
|
||||
})
|
||||
// 加
|
||||
let addElm = circleElm.getElementsByClassName('circle-add')[0]
|
||||
addElm && addElm.addEventListener('click', () => {
|
||||
this.options.circle.push({
|
||||
radius: 0,
|
||||
color: 'rgba(255,255,255,1)'
|
||||
})
|
||||
let radius = 0
|
||||
for (let i = 0; i < this.options.circle.length; i++) {
|
||||
if (Number(this.options.circle[i].radius) > radius) {
|
||||
radius = Number(this.options.circle[i].radius)
|
||||
}
|
||||
}
|
||||
this._radius = radius
|
||||
CircleDiffuse.create(this)
|
||||
this._createCircleElm()
|
||||
})
|
||||
|
||||
circleContentElm.appendChild(circleElm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_addLink() {
|
||||
// document.getElementsByClassName
|
||||
if (this._DialogObject._element.content.getElementsByClassName('link_add')[0].value) {
|
||||
this.options.attribute.link.content.push({
|
||||
name: '链接',
|
||||
url: this._DialogObject._element.content.getElementsByClassName('link_add')[0].value
|
||||
})
|
||||
this._DialogObject._element.content.getElementsByClassName('link_add')[0].value = ''
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
}
|
||||
else {
|
||||
this.Dialog.clickAddLink && this.Dialog.clickAddLink()
|
||||
}
|
||||
}
|
||||
|
||||
addAttributeLink(link) {
|
||||
this.options.attribute.link.content.push({
|
||||
name: '链接',
|
||||
url: link
|
||||
})
|
||||
this.attributeLink = this.options.attribute.link.content
|
||||
}
|
||||
|
||||
_addRr() {
|
||||
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
|
||||
this.options.attribute.vr.content.push({
|
||||
name: '全景图' ,
|
||||
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
|
||||
})
|
||||
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
}
|
||||
else {
|
||||
this.Dialog.clickAddVr && this.Dialog.clickAddVr()
|
||||
}
|
||||
}
|
||||
|
||||
addAttributeRr(vr) {
|
||||
this.options.attribute.vr.content.push({
|
||||
name: '全景图' ,
|
||||
url: vr
|
||||
})
|
||||
this.attributeVr = this.options.attribute.vr.content
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开富文本框
|
||||
*/
|
||||
openRichTextEditor(e) {
|
||||
richText.open(this.options.id, this.options.name, this.options.richTextContent)
|
||||
richText.primaryCallBack = (content) => {
|
||||
this.options.richTextContent = content
|
||||
}
|
||||
}
|
||||
|
||||
setDIV(options = { domid: "", x: 10, y: 10 }) {
|
||||
options.x = (options.x || options.x === 0) ? options.x : 10
|
||||
options.y = (options.y || options.y === 0) ? options.y : 10
|
||||
|
Reference in New Issue
Block a user