Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop

This commit is contained in:
zh
2025-08-26 21:03:40 +08:00
2 changed files with 13 additions and 4 deletions

View File

@ -33,7 +33,7 @@ class TextBox extends Base {
this.callback = callback this.callback = callback
// syncData(this.sdk, this.options.id) syncData(this.sdk, this.options.id)
} }
@ -134,15 +134,17 @@ class TextBox extends Base {
} }
async getwords(words) { async getwords(words) {
this.options.text = words this.options.text = words
this.callback(this.options)
let { sdkP } = getSdk() let { sdkP } = getSdk()
if (this.sdk === sdkP && sdkP) {//三维 if (this.sdk === sdkP && sdkP) {//三维
this.callback(this.options)
syncData(this.sdk, this.options.id) syncData(this.sdk, this.options.id)
} }
else if (sdkP) {//二维 else if (sdkP) {//二维
sdkP.entityMap.get(this.options.id).text = words sdkP.entityMap.get(this.options.id).text = words
sdkP.entityMap.get(this.options.id).twoToThree(this.options.position) sdkP.entityMap.get(this.options.id).twoToThree(this.options.position)
} else if (!sdkP) { } else if (!sdkP) {
this.callback(this.options)
syncData(this.sdk, this.options.id) syncData(this.sdk, this.options.id)
} }
} }
@ -283,6 +285,7 @@ class TextBox extends Base {
this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom); this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom);
} }
await this.sdk.removeIncetance(this.options.id) await this.sdk.removeIncetance(this.options.id)
syncData(this.sdk, this.options.id)
} }
flicker() { } flicker() { }

View File

@ -443,8 +443,14 @@ class YJEarth {
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id) _this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
_this.blurFun = () => { _this.blurFun = () => {
_this.entityMap.get(_this.clickTextDom.id).isClick((movement && movement.position) || null, _this.clickTextDom.id) // let { sdkP } = getSdk()
// if (_this == sdkP && sdkP) {//二维
// _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
// } else if (!sdkP) {
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
// }
_this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun)
} }
_this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun) _this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun)
break; break;
@ -501,7 +507,7 @@ class YJEarth {
_this.clickTextDom.removeEventListener('mousedown', mousedown); _this.clickTextDom.removeEventListener('mousedown', mousedown);
_this.viewer._element.removeEventListener('mousemove', mousemove); _this.viewer._element.removeEventListener('mousemove', mousemove);
_this.viewer._element.removeEventListener('mouseup', mouseup); _this.viewer._element.removeEventListener('mouseup', mouseup);
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value) // _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
_this.clickTextDom.style['pointer-events'] = 'none' _this.clickTextDom.style['pointer-events'] = 'none'
_this.clickTextDom = undefined _this.clickTextDom = undefined