xzw 4 年之前
父节点
当前提交
584a4e353b
共有 6 个文件被更改,包括 206 次插入88 次删除
  1. 20 19
      css/main.css
  2. 14 1
      edit.html
  3. 39 4
      js/edit.js
  4. 111 53
      js/main_2020_edit.js
  5. 19 10
      js/main_2020_show.js
  6. 3 1
      js/selectHardware.js

+ 20 - 19
css/main.css

@@ -7089,6 +7089,7 @@ a.hasHover.tag-link:hover {
 #hotPannel{ 
     z-index:9999; 
     font-size:16px;
+    text-align:left;
 }
 #hotPannel>div{
     padding:5px 20px; 
@@ -7105,6 +7106,7 @@ a.hasHover.tag-link:hover {
 #hotPannel .title{
     color:rgb(0 200 175);
     font-size:18px;
+    padding-right:20px;
 }
 #hotPannel .close{
     background-size: contain;
@@ -7121,22 +7123,21 @@ a.hasHover.tag-link:hover {
 
 
 
-.switch {
+#hotPannel .switch {
     display: flex;
     /* justify-content: center; */
-    margin-left:5px !important
-    
+    margin-left:0px !important; 
 } 
-.switch label {
+#hotPannel .switch label {
     display: block;
     vertical-align: middle;
 }
 
-.switch input {
+#hotPannel .switch input {
     vertical-align: middle;
 }
 
-.switch .mui-switch {
+#hotPannel .switch .mui-switch {
     width: 60px !important;
     height: 26px !important;
     position: relative !important;
@@ -7161,7 +7162,7 @@ a.hasHover.tag-link:hover {
 }
 
 
-.switch .mui-switch:before {
+#hotPannel .switch .mui-switch:before {
     content: '';
     width: 20px;
     height: 20px;
@@ -7177,7 +7178,7 @@ a.hasHover.tag-link:hover {
     /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); */
 }
  
-.switch .mui-switch:after {
+#hotPannel .switch .mui-switch:after {
     content:'OFF';
     color:rgb(0 200 175);
     font-weight:bold;
@@ -7186,56 +7187,56 @@ a.hasHover.tag-link:hover {
     font-size:6px;
     top: 4px;
 }
-.switch .mui-switch:checked:after {
+#hotPannel .switch .mui-switch:checked:after {
     content:'ON';
     left: 10px;
     color:#000000;
 }
 
-.switch .mui-switch:checked {
+#hotPannel .switch .mui-switch:checked {
     border-color: #00b4ed;
     box-shadow: #00b4ed 0 0 0 16px inset;
     background-color: #00b4ed;
 }
 
-.switch .mui-switch:checked:before {
+#hotPannel .switch .mui-switch:checked:before {
     left: 35px;
     background-color: #000000;
 }
 
-.switch .mui-switch.mui-switch-animbg {
+#hotPannel .switch .mui-switch.mui-switch-animbg {
     transition: background-color ease 0.4s;
 }
 
-.switch .mui-switch.mui-switch-animbg:before {
+#hotPannel .switch .mui-switch.mui-switch-animbg:before {
     transition: left 0.3s;
 }
 
-.switch .mui-switch.mui-switch-animbg:checked {
+#hotPannel .switch .mui-switch.mui-switch-animbg:checked {
     box-shadow: #dfdfdf 0 0 0 0 inset;
     background-color: rgb(0 200 175) !important;
     transition: border-color 0.4s, background-color ease 0.4s;
     /* cursor: pointer; */
 }
 
-.switch .mui-switch.mui-switch-animbg:checked:before {
+#hotPannel .switch .mui-switch.mui-switch-animbg:checked:before {
     transition: left 0.3s;
 }
 
-.switch .mui-switch.mui-switch-anim {
+#hotPannel .switch .mui-switch.mui-switch-anim {
     transition: border cubic-bezier(0, 0, 0, 1) 0.4s, box-shadow cubic-bezier(0, 0, 0, 1) 0.4s;
 }
 
-.switch .mui-switch.mui-switch-anim:before {
+#hotPannel .switch .mui-switch.mui-switch-anim:before {
     transition: left 0.3s;
 }
 
-.switch .mui-switch.mui-switch-anim:checked {
+#hotPannel .switch .mui-switch.mui-switch-anim:checked {
     box-shadow: #64bd63 0 0 0 16px inset;
     background-color: #64bd63;
     transition: border ease 0.4s, box-shadow ease 0.4s, background-color ease 1.2s;
 }
 
-.switch .mui-switch.mui-switch-anim:checked:before {
+#hotPannel .switch .mui-switch.mui-switch-anim:checked:before {
     transition: left 0.3s;
 }

+ 14 - 1
edit.html

@@ -143,6 +143,19 @@
                         <div class="content">
                             <div id="hot">
                             </div>
+                            <div id="hotPannel">
+                                <div>
+                                    <div class='title'>标题</div>
+                                    <span class='close'></span>    
+                                    <div>当前状态: 关</div> 
+                                    <div>
+                                        <label class='switch'>
+                                            开关灯
+                                            <input class="mui-switch mui-switch-animbg" type="checkbox"> 
+                                        </label> 
+                                    </div>
+                                </div>    
+                            </div>
                             <div id="popup">
                                 <div class="popup-content">
 
@@ -1138,7 +1151,7 @@
                                         </li>
                                     </ul>
                                 </li>
-                                <li>
+                                <li name='addHardware'>
                                     <div class="itemTitle">
                                         <span>添加硬件</span>
                                     </div>

+ 39 - 4
js/edit.js

@@ -21,7 +21,7 @@ var _hotNum = 0
 function reData(data, type) {
     return JSON.stringify(data) == type ? null : data
 }
-
+//window.EditTools
 //新编辑界面
 var EditTools = function(n) {
     //main2018 里面的主要对象
@@ -181,7 +181,7 @@ EditTools.prototype.initSaveAll = function() {
                     delete hot.infoAttribute.quaternion;
                     delete hot.infoAttribute.rotation;
                 }
-
+        
             }
 
             var info = {
@@ -611,6 +611,7 @@ Hotpoint.prototype.init = function(n) {
             hot.isSprite = info.isSprite
             hot.noAction = info.noAction
             hot.linkOutside = info.linkOutside
+            hot.hardware = info.hardware
         }
         that.hotpointDetail.addClass("atRight");
         transformControls.detach()
@@ -632,6 +633,12 @@ Hotpoint.prototype.init = function(n) {
         
       })
     }) */
+    
+    this.hotpointDetail.find("li[name='addHardware'] #grDel").on("click",()=>{
+        this.editSpot.hardwareTemp = {};  //清空时不能为null!
+        this.hotpointDetail.find("li[name='addHardware'] #grAdd").removeClass('unable');
+        this.editSpot.showPannel()
+    })
 }
 
 /**
@@ -664,7 +671,14 @@ Hotpoint.prototype.editHot = function(target) {
     info.video = info.video || [];
     info.isSprite = this.editSpot.isSprite
     info.noAction = this.editSpot.noAction
-
+    info.hardwareTemp = info.hardware || {}
+    if(info.hardware && info.hardware.id!=void 0){
+        this.hotpointDetail.find("li[name='addHardware'] #grAdd").addClass("unable");
+    }else{
+        this.hotpointDetail.find("li[name='addHardware'] #grAdd").removeClass("unable");
+    }
+    
+    
     try {
         transformControls.attach(player.model.hots[li_id].mesh)
         player.model.hots[li_id].examine(player, {
@@ -1217,7 +1231,11 @@ Hotpoint.prototype.initSaveHot = function() {
             console.log(args);
             //把获取的所有信息都保存在对应热点的dom元素里面
             //hotpointDetail[0].targetDOM.infoAttribute = args;
-            hot.infoAttribute = args;
+            hot.infoAttribute = args; 
+            
+            args.hardware = hot.hardwareTemp || {};
+            
+            
             $layout.addClass('hide');
             hotpointDetail.addClass("atRight");
             spot.find(".title").html(args.title);
@@ -1248,6 +1266,23 @@ Hotpoint.prototype.initSaveHot = function() {
     })
 }
 
+
+Hotpoint.prototype.addHardware = function(dom){
+    var hot = this.editSpot
+    var info = {
+        //index:  dom.chidren[1], //序号 1
+        deviceCode : dom.children[2].innerHTML, //编号 34020000001310000054
+        deviceType : dom.children[3].innerHTML, //类型  灯控
+        name: dom.children[4].innerHTML,  // IPC-138 二楼茶水间灯控1 
+        id : dom.children[5].innerHTML,     //00b793677c0d03bc2b7aee5b28fb8fd3 
+    }
+    hot.hardwareTemp = info;
+    hot.showPannel()
+    this.hotpointDetail.find("li[name='addHardware'] #grAdd").addClass("unable");
+}
+
+
+
 //背景音乐
 var EditMiuse = function() {
     this.mediaUpload = $(".music .audio.mediaUpload");

+ 111 - 53
js/main_2020_edit.js

@@ -1,3 +1,26 @@
+
+
+
+
+//热点  设备控制
+
+$("#hotPannel .close").on('click',()=>{
+    $("#hotPannel>div").css("display","");
+    window.hotNeedUpdatePanel = null;
+     
+})
+
+$("#hotPannel input.mui-switch").on('change',()=>{
+    var ifOn = $('#hotPannel input.mui-switch').is(':checked');
+   
+})
+
+
+
+
+
+
+
 var dom = {
     getOffset: function(e, t, i) {
         for (left = "left" == e ? t.offsetLeft : t.offsetTop,
@@ -14877,6 +14900,9 @@ function o(a, s, l) {
             if(this.isSprite){
                 this.mesh.quaternion.copy(camera.quaternion)
             }
+            if(window.hotNeedUpdatePannel == this){
+                this.updatePannel()
+            }
         }
         n.prototype.setVisiblePanos = function(visibleData){ 
             if(visibleData == "get"){ 
@@ -14909,6 +14935,32 @@ function o(a, s, l) {
             
             
         }
+        
+        
+        
+        n.prototype.showPannel = function(){
+            var hardware = this.hardwareTemp || this.infoAttribute.hardware //hardwareTemp为编辑时绝对有的,如果是{}代表没有 
+            if(hardware && hardware.id!=void 0){
+                $("#hotPannel>div").css("display","block");
+                $("#hotPannel .title").text(hardware.name);
+                
+                this.updatePannel()
+                window.hotNeedUpdatePannel = this
+            }else{
+                $("#hotPannel>div").css("display","");
+            }
+        }
+        n.prototype.updatePannel = function(){
+            var pos = math.getPos2d(this.position, player.camera, $("#player")[0])
+            $("#hotPannel>div").css( { "left" : `${pos.pos.x}px`,  "top": `${pos.pos.y}px ` });
+            
+        }
+        
+        
+        
+        
+        
+        
         n.prototype.createTitleElem = function(title){
             var root = $("#hot");
             var elem = $(`<div> ${title}</div>`)
@@ -14981,66 +15033,72 @@ function o(a, s, l) {
         
         n.prototype.examine = function(e, options) {
             options = options || {}
-            if(this.linkType!="common" && this.infoAttribute.iframe && this.infoAttribute.iframe[0] && !options.dontOpen){
-                var src = getLink(this.infoAttribute.iframe[0]);
-                if(this.linkType=="jumpLink"){
-                    var newPage = window.open(src, "_blank" ); 
-                    newPage.focus();  
-                }else if(this.linkType=="iframeDiv"){
-                    
-                    var div = document.createElement("div");
-                    $("body").append(div);
-                    div.style.position = 'fixed';
-                    div.style.width = div.style.height = "100%";
-                    div.style.left = div.style.top = '0';
-                    div.style["z-index"] = "999"
-                    
-                    var exit = document.createElement("div");
-                    exit.style["background-image"] = "url(images/vrOffImg.png)";
-                    exit.style.position = 'absolute';
-                    exit.style.width = exit.style.height = "50px";
-                    exit.style.left = '17px';   exit.style.top = "20px"
-                    exit.style.cursor = "pointer";
-                    exit.style["background-repeat"] = "no-repeat";
-                    exit.style["background-size"] = "25%"; 
-                    exit.style["background-position"] = "center center"; 
-                    exit.style["background-color"] = "rgba(0, 0, 0, 0.2)"; 
-                    exit.style["border-radius"] = "50%";
-                    exit.style["z-index"] = "3"
-                    exit.onclick = ()=>{
-                        $(div).remove()
-                        if(g_bgAudio && g_bgAudio.pauseByHot){
-                            manage.switchBgmState(true)
-                        }
-                    }  
-                    
-                    var myElement = document.createElement("iframe");
-                    myElement.style.position = 'absolute';
-                    myElement.style.width = myElement.style.height = "100%";
-                    myElement.style.left = myElement.style.top = '0';
-                     
-                    myElement.src = src
-                     
+            var hotPop = document.getElementById('popup');
+            
+            if(window.MP_PREFETCHED_MODELDATA.flyInOnlyBySwitch){ 
+                this.showPannel();
+                if(player.mode != 'panorama' || !player.currentPano)return; 
+            }else{
+                if(this.linkType!="common" && this.infoAttribute.iframe && this.infoAttribute.iframe[0] && !options.dontOpen){
+                    var src = getLink(this.infoAttribute.iframe[0]);
+                    if(this.linkType=="jumpLink"){
+                        var newPage = window.open(src, "_blank" ); 
+                        newPage.focus();  
+                    }else if(this.linkType=="iframeDiv"){
+                        
+                        var div = document.createElement("div");
+                        $("body").append(div);
+                        div.style.position = 'fixed';
+                        div.style.width = div.style.height = "100%";
+                        div.style.left = div.style.top = '0';
+                        div.style["z-index"] = "999"
+                        
+                        var exit = document.createElement("div");
+                        exit.style["background-image"] = "url(images/vrOffImg.png)";
+                        exit.style.position = 'absolute';
+                        exit.style.width = exit.style.height = "50px";
+                        exit.style.left = '17px';   exit.style.top = "20px"
+                        exit.style.cursor = "pointer";
+                        exit.style["background-repeat"] = "no-repeat";
+                        exit.style["background-size"] = "25%"; 
+                        exit.style["background-position"] = "center center"; 
+                        exit.style["background-color"] = "rgba(0, 0, 0, 0.2)"; 
+                        exit.style["border-radius"] = "50%";
+                        exit.style["z-index"] = "3"
+                        exit.onclick = ()=>{
+                            $(div).remove()
+                            if(g_bgAudio && g_bgAudio.pauseByHot){
+                                manage.switchBgmState(true)
+                            }
+                        }  
+                        
+                        var myElement = document.createElement("iframe");
+                        myElement.style.position = 'absolute';
+                        myElement.style.width = myElement.style.height = "100%";
+                        myElement.style.left = myElement.style.top = '0';
+                         
+                        myElement.src = src
+                         
+                        
+                        div.appendChild(exit);
+                        div.appendChild(myElement)
+                        
+                        
+                        if(g_bgAudio && !g_bgAudio.paused){
+                            manage.switchBgmState(false); 
+                            g_bgAudio.pauseByHot = true
+                        } 
+                        if(g_tourAudio)g_tourAudio.pause()
+                        
+                    }
                     
-                    div.appendChild(exit);
-                    div.appendChild(myElement)
                     
                     
-                    if(g_bgAudio && !g_bgAudio.paused){
-                        manage.switchBgmState(false); 
-                        g_bgAudio.pauseByHot = true
-                    } 
-                    if(g_tourAudio)g_tourAudio.pause()
                     
+                    return;
                 }
                 
-                
-                
-                
-                return;
             }
-            
-            
              
             
             if(!player.currentPano)return;     

+ 19 - 10
js/main_2020_show.js

@@ -19,7 +19,7 @@
 
 $("#hotPannel .close").on('click',()=>{
     $("#hotPannel>div").css("display","");
-    window.hotNeedUpdatePanel = null;
+    window.hotNeedUpdatePannel = null;
      
 })
 
@@ -15475,8 +15475,8 @@ window.Modernizr = function(n, e, t) {
             if(this.isSprite){
                 this.mesh.quaternion.copy(camera.quaternion)
             }
-            if(window.hotNeedUpdatePanel == this){
-                this.updatePanel()
+            if(window.hotNeedUpdatePannel == this){
+                this.updatePannel()
             }
         }
         hot.prototype.setVisiblePanos = function(visibleData){ 
@@ -15518,7 +15518,20 @@ window.Modernizr = function(n, e, t) {
             this.titleElem = elem;
         } 
         
-        hot.prototype.updatePanel = function(){
+        
+        hot.prototype.showPannel = function(){
+            var hardware = this.infoAttribute.hardware
+            if(hardware && hardware.id!=void 0){
+                $("#hotPannel>div").css("display","block");
+                $("#hotPannel .title").text(hardware.name);
+                
+                this.updatePannel()
+                window.hotNeedUpdatePannel = this
+            }else{
+                $("#hotPannel>div").css("display","");
+            }
+        }
+        hot.prototype.updatePannel = function(){
             var pos = math.getPos2d(this.position, player.camera, $("#player")[0])
             $("#hotPannel>div").css( { "left" : `${pos.pos.x}px`,  "top": `${pos.pos.y}px ` });
             
@@ -15597,12 +15610,8 @@ window.Modernizr = function(n, e, t) {
             var hotPop = document.getElementById('popup');
             
             
-            if(window.MP_PREFETCHED_MODELDATA.flyInOnlyBySwitch){
-                $("#hotPannel>div").css("display","block");
-                $("#hotPannel>div").text(this.infoAttribute.title)
-                this.updatePanel()
-                window.hotNeedUpdatePanel = this
-                
+            if(window.MP_PREFETCHED_MODELDATA.flyInOnlyBySwitch){ 
+                this.showPannel();
                 if(player.mode != 'panorama' || !player.currentPano)return; 
             }else{
                  

+ 3 - 1
js/selectHardware.js

@@ -44,7 +44,9 @@ $(function () {
       alert('请选择设备')
       return
     }
-    alert(item)
+    window.editTool.hotpoint.addHardware(item[0])
+    
+    //alert(item)
     console.log(GridManager.getCheckedTr(gName));
   })