DR/4DAGE 3 роки тому
батько
коміт
92b92a8a14
2 змінених файлів з 25 додано та 31 видалено
  1. 1 8
      Map/index.html
  2. 24 23
      Map/map.js

+ 1 - 8
Map/index.html

@@ -44,16 +44,9 @@
             left: 20%;
         }
         #font{
-            position: absolute;
-            z-index: 100;
-            bottom: 8%;
-            background-color:rgba(157,96,34,0.5);
-            color:white;
-            /* left:30%; */
-            height: 50px;
             border-radius: 15px;
             text-align:left;
-            line-height:20px;
+            bottom: 2%;
         }
     </style>
      <script src="./Source/DGE.min.js"></script>

+ 24 - 23
Map/map.js

@@ -163,28 +163,28 @@ function addStr(str){
  * @param {*} txtdiv  字符串要展示的div
  */
 function setFont(str,txtdiv){
-        let count =parseInt(20/400*window.innerWidth)-4;
-        let strCount=str.length;
-        let rows=Math.ceil(strCount/count);
-        let endCount=strCount%count;
-        let rowCounts=[];
-        let innertxt="";
-        for(let i=1;i<rows;i++){
-            rowCounts.push(count);
-            innertxt+=str.substr(count*(i-1),count)+"<br>";
-        }
-        rowCounts.push(endCount)
-        innertxt+=str.substr(count*(rows-1),endCount==0?count:endCount);
-        txtdiv.innerHTML=innertxt;
-    let width=(window.innerWidth-txtdiv.clientWidth)/2;
-    let fontsize=14/1920 *window.innerWidth*(6*400/window.innerWidth);
-     let left=(width/window.innerWidth)*100+"%";
-     let padding=fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px";
-     let styleStr="position: absolute;z-index: 100;bottom: 10%;background-color:rgba(157,96,34,0.5);padding:"+padding+";color:white;left:"+left+";font-size:"+fontsize+"px;";
-     //styleStr+="lineHeight:"+5*rows+"px;";
-     styleStr+=" line-height:23px;"
-     styleStr+="height:"+(25*rows)+"px"
-     txtdiv.setAttribute('style',styleStr);
+            let count =parseInt(20/400*window.innerWidth);
+            let strCount=str.length;
+            let rows=Math.ceil(strCount/count);
+            let endCount=strCount%count;
+            let rowCounts=[];
+            let innertxt="";
+            for(let i=1;i<rows;i++){
+                rowCounts.push(count);
+                innertxt+=str.substr(count*(i-1),count)+"<br>";
+            }
+            rowCounts.push(endCount)
+            innertxt+=str.substr(count*(rows-1),endCount==0?count:endCount);
+            txtdiv.innerHTML=innertxt;
+        let width=(window.innerWidth-txtdiv.clientWidth)/2;
+        let fontsize=14/1920 *window.innerWidth*(6*400/window.innerWidth);
+         let left=(width/window.innerWidth)*100+"%";
+         let padding=fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px";
+         let styleStr="position: absolute;z-index: 100;background-color:rgba(157,96,34,0.5);padding:"+padding+";color:white;left:"+left+";font-size:"+fontsize+"px;";
+         //styleStr+="lineHeight:"+5*rows+"px;";
+         styleStr+=" line-height:23px;"
+         styleStr+="height:"+(25*rows)+"px;"
+         txtdiv.setAttribute('style',styleStr);  
 }
 // //字体自动大小适应
 // function setFontStyle(){
@@ -205,7 +205,8 @@ function clear(){
         txtdiv.removeChild(txtdiv.firstChild);
     }
     txtdiv.display="none"
-   
+    txtdiv.style.backgroundColor="rgba(157,96,34,0.01);"
+   console.log("clear")
 }
 
 //开始播放