From 92ef4a68fd4b72e35bbb7464bec7928379bb38f8 Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Tue, 26 Aug 2025 18:07:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=97=B6=E7=9A=84=E9=94=AE=E7=9B=98=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/KeyBoard/index.js | 38 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/Global/KeyBoard/index.js b/src/Global/KeyBoard/index.js index 7095bfe..90014e0 100644 --- a/src/Global/KeyBoard/index.js +++ b/src/Global/KeyBoard/index.js @@ -101,6 +101,7 @@ function getFlagFromKeyboard(key) { */ function keyDown(event) { let _viewer = this + // 判断是否有输入框聚焦 function isInputFocused() { const activeElement = document.activeElement; @@ -164,32 +165,51 @@ function keyUp(event) { * @return {*} */ function keyboardMapRoamingRender(_viewer) { - if(!_viewer.scene.screenSpaceCameraController.enableTilt) { + if(!_viewer || !_viewer.scene || !_viewer.scene.screenSpaceCameraController.enableTilt) { return } let camera = _viewer.camera; let ellipsoid = _viewer.scene.globe.ellipsoid; let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height; + let cameraHeight2 = camera.positionCartographic.height; + // 根据相机高度设置移动距离,比默认距离移动效果更好 let moveRate = cameraHeight / 20.0; let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch); + let moveRate2 = cameraHeight2 / 100.0; if (flags.moveForward) { - // camera.moveForward(moveRate); - camera.rotate(camera.right, -rotationRate); + if(_viewer.scene.mode == 2) { + camera.moveUp(moveRate2); + } + else { + camera.rotate(camera.right, -rotationRate); + } } if (flags.moveBackward) { - // camera.moveBackward(moveRate); - camera.rotate(camera.right, rotationRate); + if(_viewer.scene.mode == 2) { + camera.moveDown(moveRate2); + } + else { + camera.rotate(camera.right, rotationRate); + } } if (flags.moveLeft) { - // camera.moveLeft(moveRate); - camera.rotate(camera.up, -rotationRate); + if(_viewer.scene.mode == 2) { + camera.moveLeft(moveRate2); + } + else { + camera.rotate(camera.up, -rotationRate); + } } if (flags.moveRight) { - // camera.moveRight(moveRate); - camera.rotate(camera.up, rotationRate); + if(_viewer.scene.mode == 2) { + camera.moveRight(moveRate2); + } + else { + camera.rotate(camera.up, rotationRate); + } } if (flags.moveUp) { camera.moveUp(moveRate); From 349c91f8df6bc365e1f03bffaf17a9ae9032554c Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Tue, 26 Aug 2025 18:08:21 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8D=B7=E5=B8=98=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E9=9A=90=E8=97=8F=E7=82=B9=E5=B1=9E=E6=80=A7=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/SplitScreen/index.js | 11 ++++++++++- src/Obj/Base/BillboardObject/index.js | 6 +++++- src/Obj/Base/index.js | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Global/SplitScreen/index.js b/src/Global/SplitScreen/index.js index fe58526..f71eb14 100644 --- a/src/Global/SplitScreen/index.js +++ b/src/Global/SplitScreen/index.js @@ -102,11 +102,20 @@ function off() { let leftCanvas = leftBox.getElementsByTagName('canvas')[0] leftBox.style.width = '100%' leftCanvas.style.width = '100%' + let billboardAttributeBoxs = sdkP.viewer._element.getElementsByClassName('billboard-attribute-box') + for (let i = 0; i < billboardAttributeBoxs.length; i++) { + billboardAttributeBoxs[i].style.display = 'block' + } sdkP = null } async function init(sdk) { + let billboardAttributeBoxs = sdk.viewer._element.getElementsByClassName('billboard-attribute-box') + for (let i = 0; i < billboardAttributeBoxs.length; i++) { + billboardAttributeBoxs[i].style.display = 'none' + } + sdk.entityMap.forEach((item, key) => { if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) { item.viewFollow = false @@ -911,7 +920,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) { } if (thatP.type === 'GroundSvg' && thatP.text) { thatP.text.show = thatP.textShow - target.textShow = false + target && (target.textShow = false) } if (thatP.label && thatP.labelShow) { thatP.label.entity.show = true diff --git a/src/Obj/Base/BillboardObject/index.js b/src/Obj/Base/BillboardObject/index.js index 322e361..4531fa4 100644 --- a/src/Obj/Base/BillboardObject/index.js +++ b/src/Obj/Base/BillboardObject/index.js @@ -29,7 +29,8 @@ import MouseTip from '../../../MouseTip' import { setSplitDirection, syncSplitData, - setActiveId + setActiveId, + getState } from '../../../Global/SplitScreen' import { setActiveViewer, @@ -2943,6 +2944,9 @@ class BillboardObject extends Base { attributeElm.style.left = '0px' attributeElm.style.width = 0 attributeElm.style.height = 0 + if(getState()) { + attributeElm.style.display = 'none' + } // attributeElm.innerHTML = this.options.richTextContent this.sdk.viewer._element.appendChild(attributeElm) let linkHtml = '' diff --git a/src/Obj/Base/index.js b/src/Obj/Base/index.js index 86f8d5f..160fba9 100644 --- a/src/Obj/Base/index.js +++ b/src/Obj/Base/index.js @@ -137,7 +137,7 @@ class Base extends Tools { this.originalOptions.show = v } } - this.entity._showView = this.showView + this.entity && (this.entity._showView = this.showView) if (this.type == 'layer') { if (this.entity) { this.entity._objectState = this.options.show From feff8c3a765642be4cd026e10a35e74ae0e5051d Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Tue, 26 Aug 2025 18:18:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Obj/Base/BillboardObject/index.js | 4 +++- src/Obj/Base/TextBox/index.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Obj/Base/BillboardObject/index.js b/src/Obj/Base/BillboardObject/index.js index 4531fa4..5355c9f 100644 --- a/src/Obj/Base/BillboardObject/index.js +++ b/src/Obj/Base/BillboardObject/index.js @@ -198,7 +198,9 @@ class BillboardObject extends Base { this.#_destroyMouseEvent = () => { this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset') - this.sdk.viewer._element.onmousemove = null + if(this.sdk && this.sdk.viewer && this.sdk.viewer._element) { + this.sdk.viewer._element.onmousemove = null + } document.removeEventListener('mouseup', this.#_destroyMouseEvent) document.removeEventListener('mouseleave', this.#_destroyMouseEvent) } diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js index 082e9b3..d957250 100644 --- a/src/Obj/Base/TextBox/index.js +++ b/src/Obj/Base/TextBox/index.js @@ -282,6 +282,7 @@ class TextBox extends Base { if (this.textDom && this.textDom.parentNode) { this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom); } + await this.sdk.removeIncetance(this.options.id) } flicker() { }