From cee67c9f4623f287ce96901763963d50cdc24736 Mon Sep 17 00:00:00 2001
From: ansel0926 <ansel0926@gmail.com>
Date: 星期一, 16 五月 2022 10:47:41 +0800
Subject: [PATCH] 提交
---
assets/utils/popup.js | 44 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/assets/utils/popup.js b/assets/utils/popup.js
index 3162ba4..751619f 100644
--- a/assets/utils/popup.js
+++ b/assets/utils/popup.js
@@ -10,16 +10,29 @@
_this.geometry = info.geometry;//寮圭獥鎸傝浇鐨勪綅缃�
_this.id = info.id;
_this.entity=info.entity;
+ _this.type=info.type;
+ _this.content=info.content;
_this.ctn = $("<div class='bx-popup-ctn' id = '"+_this.id+"'>");
var entity={"id":_this.id,"dom":_this.ctn};
Popup.prototype.dom.push(entity);
$(_this.viewer.container).append( _this.ctn);
- //娴嬭瘯寮圭獥鍐呭
- var testConfig = {
- header:_this.entity._name,
- content:'<img class="image" style="width:100%;height:100%;max-width:200px;max-height:150px" src=""></img>'
+ //寮圭獥鍐呭
+ var testConfig;
+ if(_this.type=="image"){
+ testConfig= {
+ header:_this.entity.title,
+ //header:"",
+ content:'<img class="image" style="width:100%;height:100%;max-width:200px;max-height:150px" src=""></img>'
+ }
+ }
+ else if(_this.type=="label"){
+ testConfig= {
+ header:_this.entity.title,
+ //header:"",
+ content:'<textarea class="textarea" style="color:white;width:100%;height:150px;max-width:200px;max-height:150px;background:transparent;resize:none" readonly="true";></textarea>'
+ }
}
_this.ctn.append(_this.createHtml(testConfig.header,testConfig.content,_this.id));
@@ -33,8 +46,23 @@
var _this = this;
var position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(_this.viewer.scene,geometry)
if(position!=null){
- _this.ctn.css("left",position.x- _this.ctn.get(0).offsetWidth/2);
- _this.ctn.css("top",position.y- _this.ctn.get(0).offsetHeight - 10);
+ let w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
+ let h=window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+ let x=position.x- _this.ctn.get(0).offsetWidth/2
+ let y=position.y- _this.ctn.get(0).offsetHeight - 10;
+ if(x<0){
+ x=330;
+ }else if(x>w){
+ x=w;
+ }
+ if(y<0){
+ y=0
+ }
+ else if(y>h){
+ y=h;
+ }
+ _this.ctn.css("left",x);
+ _this.ctn.css("top",y);
}
}
// 鍔ㄦ�佺敓鎴愬唴瀹�
@@ -48,8 +76,8 @@
'</div>'+
'</div>'+
'<div class="bx-popup-tip-container" >'+
- '<div class="bx-popup-tip" >'+
- '</div>'+
+ // '<div class="bx-popup-tip" >'+
+ // '</div>'+
'</div>'+
'<a class="leaflet-popup-close-button" onClick="Popup.prototype.close(\''+id+'\')">X</a>';
return html;
--
Gitblit v1.9.1