From 4247327bfa9835873a0a19d29731a13d67c8924b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com> Date: Sat, 23 Aug 2025 00:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC=E6=A1=86?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Obj/Base/TextBox/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js index 0179243..8a974d9 100644 --- a/src/Obj/Base/TextBox/index.js +++ b/src/Obj/Base/TextBox/index.js @@ -54,7 +54,6 @@ class TextBox extends Base { // 配置CSS样式和内容结构 viewer.cesiumWidget.container.appendChild(dom); let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng.toFixed(4), that.options.position.lat.toFixed(4), that.options.position.alt.toFixed(4)) - that.handler = function () { const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( viewer.scene, posi @@ -80,12 +79,15 @@ class TextBox extends Base { var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var longitude = Cesium.Math.toDegrees(cartographic.longitude); var latitude = Cesium.Math.toDegrees(cartographic.latitude); + + let height = await that.getClampToHeight({ lng: longitude, lat: latitude }) that.position = { lng: longitude, lat: latitude, - alt: cartographic.height + // alt: cartographic.height + alt: height } - let posi = Cesium.Cartesian3.fromDegrees(longitude.toFixed(4), latitude.toFixed(4), cartographic.height.toFixed(4)) + let posi = Cesium.Cartesian3.fromDegrees(longitude.toFixed(4), latitude.toFixed(4), height.toFixed(4)) that.handler = function () { const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(