diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js index 24dce56..5e5697b 100644 --- a/src/Obj/Base/TextBox/index.js +++ b/src/Obj/Base/TextBox/index.js @@ -10,7 +10,7 @@ class TextBox extends Base { * @description 文本框 * @param options {object} 属性 * @param options.id=id - * @param options.positions=[]位置 + * @param options.position=[]位置 * @param options.text=文本框内容 * @param options.show=true {boolean}是否显示 * @param callback=方法回调 @@ -21,7 +21,7 @@ class TextBox extends Base { // this.sdk = { ...sdk } // this.options = { ...options } super(sdk, options) - this.options.positions = options.positions || [] + this.options.position = options.position || [] this.options.text = options.text || '' this.options.show = (options.show || options.show === false) ? options.show : true this.clickTextDom = undefined @@ -53,7 +53,7 @@ class TextBox extends Base { // 配置CSS样式和内容结构 viewer.cesiumWidget.container.appendChild(dom); - let posi = Cesium.Cartesian3.fromDegrees(that.options.positions.lng, that.options.positions.lat, that.options.positions.alt) + let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt) that.handler = function () { const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( @@ -80,7 +80,7 @@ class TextBox extends Base { var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var longitude = Cesium.Math.toDegrees(cartographic.longitude); var latitude = Cesium.Math.toDegrees(cartographic.latitude); - that.positions = { + that.position = { lng: longitude, lat: latitude, alt: cartographic.height @@ -115,11 +115,11 @@ class TextBox extends Base { this.options.show = v this.textDom && (this.textDom.style.display = v ? 'block' : 'none'); } - get positions() { - return this.options.positions + get position() { + return this.options.position } - set positions(v) { - this.options.positions = v + set position(v) { + this.options.position = v } async flyTo(options = {}) { setActiveViewer(0) @@ -142,8 +142,8 @@ class TextBox extends Base { if (this.options.position) { position = { ...this.options.position } } - else if (this.options.positions) { - position = { ...this.options.positions[0] } + else if (this.options.position) { + position = { ...this.options.position[0] } } else if (this.options.center) { position = { ...this.options.center } @@ -178,9 +178,9 @@ class TextBox extends Base { else { let positionArray = [] let a = Cesium.Cartesian3.fromDegrees( - this.positions.lng, - this.positions.lat, - this.positions.alt + this.position.lng, + this.position.lat, + this.position.alt ) positionArray.push(a.x, a.y, a.z)