Compare commits

...

2 Commits

Author SHA1 Message Date
f9a3ffb359 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-26 14:27:44 +08:00
f5d915bd58 文字 2025-08-26 14:27:41 +08:00
3 changed files with 13 additions and 4 deletions

View File

@ -76,8 +76,8 @@ class BatchModel extends Base {
}) })
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1]) let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2]) let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
let num1 = dis1 / options.spacing let num1 = dis1 / this.options.spacing
let num2 = dis2 / options.spacing let num2 = dis2 / this.options.spacing
if (num1 * num2 > 100) { if (num1 * num2 > 100) {
tools.message({ type: 'warning', text: '数量大于100请重新绘制' }) tools.message({ type: 'warning', text: '数量大于100请重新绘制' })
return; return;
@ -90,7 +90,7 @@ class BatchModel extends Base {
for (let i = 0; i < posi.length - 2; i++) { for (let i = 0; i < posi.length - 2; i++) {
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1]) dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
} }
if (dis / options.spacing > 100) { if (dis / this.options.spacing > 100) {
tools.message({ type: 'warning', text: '数量大于100请重新绘制' }) tools.message({ type: 'warning', text: '数量大于100请重新绘制' })
return; return;
} }

View File

@ -2,6 +2,7 @@
* 文本框 * 文本框
*/ */
import Base from "../index"; import Base from "../index";
import { syncData } from '../../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global' import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
class TextBox extends Base { class TextBox extends Base {
/** /**
@ -30,6 +31,9 @@ class TextBox extends Base {
this.create(this) this.create(this)
this.sdk.addIncetance(this.options.id, this) this.sdk.addIncetance(this.options.id, this)
this.callback = callback this.callback = callback
// syncData(this.sdk, this.options.id)
} }
get type() { get type() {
@ -129,6 +133,7 @@ class TextBox extends Base {
async getwords(words) { async getwords(words) {
this.options.text = words this.options.text = words
this.callback(this.options) this.callback(this.options)
syncData(this.sdk, this.options.id)
} }
async returnFun() { async returnFun() {
return this.handler return this.handler
@ -149,6 +154,7 @@ class TextBox extends Base {
set show(v) { set show(v) {
this.options.show = v this.options.show = v
this.textDom && (this.textDom.style.display = v ? 'block' : 'none'); this.textDom && (this.textDom.style.display = v ? 'block' : 'none');
// syncData(this.sdk, this.options.id)
} }
get position() { get position() {
return this.options.position return this.options.position

View File

@ -419,7 +419,9 @@ class YJEarth {
let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas) let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas)
ClickHandler.setInputAction((movement) => { ClickHandler.setInputAction((movement) => {
let textList = document.getElementsByClassName('popup-textarea') console.log(_this.viewer, 'hhhh')
// let textList = document.getElementsByClassName('popup-textarea')
let textList = _this.viewer._element.getElementsByClassName('popup-textarea')
_this.isLeftClick = false _this.isLeftClick = false
for (let i = textList.length - 1; i > -1; i--) { for (let i = textList.length - 1; i > -1; i--) {
let left = returnNumber(textList[i].style.left) let left = returnNumber(textList[i].style.left)
@ -428,6 +430,7 @@ class YJEarth {
let height = textList[i].clientHeight * 1 let height = textList[i].clientHeight * 1
let x = movement.position.x let x = movement.position.x
let y = movement.position.y let y = movement.position.y
console.log(i, left, top, width, height, x, y, 'yyyyy')
if (x > left && x < left + width && y > top && y < top + height) { if (x > left && x < left + width && y > top && y < top + height) {
if (_this.clickTextDom) { if (_this.clickTextDom) {
_this.clickTextDom.style['pointer-events'] = 'none' _this.clickTextDom.style['pointer-events'] = 'none'