xzw 4 năm trước cách đây
mục cha
commit
08bcb8d6da
6 tập tin đã thay đổi với 531 bổ sung459 xóa
  1. 159 3
      css/main.css
  2. 6 0
      edit.html
  3. 13 0
      index.html
  4. 7 2
      js/edit.js
  5. 292 265
      js/main_2020_show.js
  6. 54 189
      js/overlay.js

+ 159 - 3
css/main.css

@@ -7060,7 +7060,7 @@ a.hasHover.tag-link:hover {
 
 
 
-#hot{ 
+#hot, #hotPannel{ 
 	padding: 0;
 	position: absolute;
 	width: 100%;
@@ -7068,9 +7068,9 @@ a.hasHover.tag-link:hover {
     pointer-events:none; 
 	z-index: 101; 
 }
-#hot>div{
+#hot>div, #hotPannel>div{
     position: absolute;
-    z-index: 999;
+    z-index: 9999;
     color: #fff;
     -webkit-user-select: none;
     -moz-user-select: none;
@@ -7083,3 +7083,159 @@ a.hasHover.tag-link:hover {
     transform:translate(20px, -50%);
 }    
 
+
+
+
+#hotPannel{ 
+    z-index:9999; 
+    font-size:16px;
+}
+#hotPannel>div{
+    padding:5px 20px; 
+    background-color:rgb(0,0,0,0.6);
+    box-shadow: 0px 0px 6px rgb(0 200 175);
+    pointer-events: auto;
+}
+#hotPannel>div>div:not(:last-child){
+    border-bottom:1px solid #fff
+}
+#hotPannel>div>div{
+    padding:14px 0;
+}
+#hotPannel .title{
+    color:rgb(0 200 175);
+    font-size:18px;
+}
+#hotPannel .close{
+    background-size: contain;
+    display:block;
+    position:absolute;
+    right: 9px;
+    top: 11px;
+    background-image:url(../images/show-close.png);
+    width: 20px;
+    height: 20px;
+    cursor: pointer;
+}
+
+
+
+
+.switch {
+    display: flex;
+    /* justify-content: center; */
+    margin-left:5px !important
+    
+} 
+.switch label {
+    display: block;
+    vertical-align: middle;
+}
+
+.switch input {
+    vertical-align: middle;
+}
+
+.switch .mui-switch {
+    width: 60px !important;
+    height: 26px !important;
+    position: relative !important;
+    border: 1px solid rgb(0 200 175) !important;
+    background-color: #fdfdfd;
+    box-shadow: #dfdfdf 0 0 0 0 inset !important;
+    order-radius: 20px !important;
+    border-top-left-radius: 20px !important;
+    border-top-right-radius: 20px !important;
+    border-bottom-left-radius: 20px !important;
+    border-bottom-right-radius: 20px !important;
+    background-clip: content-box !important;
+    display: inline-block !important;
+    -webkit-appearance: none !important;
+    user-select: none !important;
+    outline: none !important;
+    padding: 0 !important;
+    background-color: rgb(0 0 0 / 86%) !important;
+    margin-left: 15px;
+    top: 0px;
+    cursor:pointer;
+}
+
+
+.switch .mui-switch:before {
+    content: '';
+    width: 20px;
+    height: 20px;
+    position: absolute;
+    top: 2px;
+    left: 2px;
+    border-radius: 20px;
+    border-top-left-radius: 20px;
+    border-top-right-radius: 20px;
+    border-bottom-left-radius: 20px;
+    border-bottom-right-radius: 20px;
+    background-color: rgb(0 200 175);
+    /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); */
+}
+ 
+.switch .mui-switch:after {
+    content:'OFF';
+    color:rgb(0 200 175);
+    font-weight:bold;
+    position: absolute;
+    left: 27px;
+    font-size:6px;
+    top: 4px;
+}
+.switch .mui-switch:checked:after {
+    content:'ON';
+    left: 10px;
+    color:#000000;
+}
+
+.switch .mui-switch:checked {
+    border-color: #00b4ed;
+    box-shadow: #00b4ed 0 0 0 16px inset;
+    background-color: #00b4ed;
+}
+
+.switch .mui-switch:checked:before {
+    left: 35px;
+    background-color: #000000;
+}
+
+.switch .mui-switch.mui-switch-animbg {
+    transition: background-color ease 0.4s;
+}
+
+.switch .mui-switch.mui-switch-animbg:before {
+    transition: left 0.3s;
+}
+
+.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 {
+    transition: left 0.3s;
+}
+
+.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 {
+    transition: left 0.3s;
+}
+
+.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 {
+    transition: left 0.3s;
+}

+ 6 - 0
edit.html

@@ -1354,6 +1354,12 @@
                                     <label for="twoData"></label>
                                     <label for="twoData">启动二代数据 <i class="colorRed">-请慎重选择</i> </label>
                                 </li>
+                                <li>
+                                    <input name="flyInOnlyBySwitch" class="editCheckbox" type="checkbox" value="twoData"
+                                        id="flyInOnlyBySwitch">
+                                    <label for="flyInOnlyBySwitch"></label>
+                                    <label for="flyInOnlyBySwitch">展示场景以2D形式 <i class="colorRed">-请慎重选择</i> </label>
+                                </li>
                             </ul>
                             
                             <ul>

+ 13 - 0
index.html

@@ -53,6 +53,19 @@
 <body>
     <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">
 

+ 7 - 2
js/edit.js

@@ -14,6 +14,7 @@ var token = window.localStorage.token
 
 var _musicMaxWeight = 8
 //M
+                                       
 
 var _hotNum = 0
 
@@ -194,7 +195,7 @@ EditTools.prototype.initSaveAll = function() {
                 loadlogo: $("#loadlogo").is(':checked'),
                 special: $("#g_specialScene").is(':checked'),
                 vision_version: $("#twoData").is(':checked') ? "1.1.562.17209" : false,
-
+                flyInOnlyBySwitch: $("#flyInOnlyBySwitch").is(':checked'),
                 /************************************** 方奕卓 场景可配置项 ******************************************/
                 hotImageScale: $("#hotImgScale").is(':checked'),
                 // 热点图片可放大
@@ -377,7 +378,10 @@ SceneInformation.prototype.init = function(data, data2) {
     if (data.vision_version === "1.1.562.17209" || data.vision_version) {
         $twoData[0].checked = true
     }
-
+    
+    if (data.flyInOnlyBySwitch) {
+        $("#flyInOnlyBySwitch")[0].checked = true
+    }
 }
 
 /**
@@ -490,6 +494,7 @@ $('input[name="show-cad"]').on('change', function(ev) {
             }
         })
     } else {
+                                          
         $('.cad').show()
     }
 })

+ 292 - 265
js/main_2020_show.js

@@ -1,78 +1,6 @@
 /* 许钟文修改的  标记 xzw    
 另外 	所有"matter"字样已被我删除				原因:删除matterport信息
   */
-  
-  
-  
-  
-  
-
-var createEnterLogo = function(){
-    var entryTex = Texture.load("images/enter.png", ()=>{
-        player.controlEntryOpacity({on:true, entryShowing:true})
-    })
-    var plane = new THREE.Mesh(new THREE.PlaneBufferGeometry(1,1,1,1), new THREE.MeshBasicMaterial({
-        transparent:true,
-        map : entryTex,
-        opacity:0,
-        color: new THREE.Color(229/255,220/255,180/255),
-    }))
-    window.enterObjects = new THREE.Object3D;
-    enterObjects.position.set(-23.611102870311473,  4.6692603935021335,  -0.800100018978118)//(-34.301849651636786,  5.301961727741601,  20.08320022583008)
-    
-    enterObjects.add(plane);
-    //player.model.add(enterObjects) 
-    
-    player.overlayGroup.add(enterObjects)
-    
-    
-}  
-var entryShowing = false;  
-var _entryOpacityId = 999
-  
-/* var updateEntryShowing = function(){
-    var maxDis = 22;
-    var show = player.position.distanceTo(enterObjects.position)<maxDis
-    if(show && !entryShowing) player.controlEntryOpacity({on:true, entryShowing:true})
-    else if(!show && entryShowing) player.controlEntryOpacity({on:false, entryShowing:false})
-}  */ 
-  
-  
- /*  n.prototype.controlEntryOpacity = function(o){
-                  
-    if(op.entryShowing!=void 0) entryShowing = op.entryShowing
-    if(entryShowing && !o.on)return 
-   
-    var startOpa = enterObjects.children[0].material.opacity;
-    var aimOpa = o.on ? 1 : 0.5
-   
-    y.cancelById(_entryOpacityId); 
-    y.start((progress)=>{ 
-        var opa = startOpa * (1-progress) + o.opacity * progress
-        enterObjects.children.forEach(plane=>{
-            plane.material.opacity = opa
-        })
-          
-    }, 1000, ()=>{//done
-        if(entryShowing){
-            this.controlEntryOpacity({on:!o.on})
-        } 
-    }, 0, f.transition.movementEasing, null, _entryOpacityId);
-    
-    
-} */
-
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
  var dom = {//许钟文add
 	getOffset: function(type, element, parent) { 
 		left = (type == "left") ? element.offsetLeft : element.offsetTop;
@@ -85,6 +13,23 @@ var _entryOpacityId = 999
 	}  
 };
 
+
+
+//热点  设备控制
+
+$("#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');
+   
+})
+
+
+
 !function() {
     "use strict";
     function t(t, i) {
@@ -14302,6 +14247,10 @@ window.Modernizr = function(n, e, t) {
                 
                 }catch(e){console.log(e) }
                      
+                     
+                data.flyInOnlyBySwitch = true     
+                     
+                     
 				window.MP_PREFETCHED_MODELDATA = data; 
                 data.model.summary = data.summary
                 data.model.name = data.name
@@ -14435,15 +14384,8 @@ window.Modernizr = function(n, e, t) {
 							N.setAppReadyTime();
 							var e = N.calcFullLoadingTime();
 							de.warn("Total load time: " + e / 1e3),
-                            H.loadComplete(e),
-                            window.parent.postMessage('loadComplete','*')
+							H.loadComplete(e),
 							de.warn("First render after model load finished.")
-                            
-                            try{ 
-                                window.parent.postMessage('loadComplete','*') 
-                            }catch(e){
-                                console.log(e)
-                            }
 						}),
 						S.on(le.MemoryUsageUpdated, n)
 					}).fail(b.bind(this, e))
@@ -15478,12 +15420,21 @@ window.Modernizr = function(n, e, t) {
            
             
 			this.build();
-            d.infoAttribute && d.infoAttribute.title && this.createTitleElem(d.infoAttribute.title)
+            
+            
+            if(d.infoAttribute && d.infoAttribute.title){
+                if(window.MP_PREFETCHED_MODELDATA.flyInOnlyBySwitch){
+                  
+                }else{
+                    this.createTitleElem(d.infoAttribute.title)  
+                }
+               
+            } 
+             
             this.changeTex()
             
             this.setVisiblePanos(d.visiblePanos); 
             this.infoAttribute = d.infoAttribute;
-            
 		}
 		var r = e("three")
 		, f = e("../shaders")
@@ -15524,6 +15475,9 @@ window.Modernizr = function(n, e, t) {
             if(this.isSprite){
                 this.mesh.quaternion.copy(camera.quaternion)
             }
+            if(window.hotNeedUpdatePanel == this){
+                this.updatePanel()
+            }
         }
         hot.prototype.setVisiblePanos = function(visibleData){ 
             if (visibleData) {
@@ -15555,12 +15509,22 @@ window.Modernizr = function(n, e, t) {
             this.model.add(sprite); 
             g_HotMeshes.push(sprite);
 		}
+         
+        
         hot.prototype.createTitleElem = function(title){
             var root = $("#hot");
             var elem = $(`<div> ${title}</div>`)
             root.append(elem);
             this.titleElem = elem;
         } 
+        
+        hot.prototype.updatePanel = function(){
+            var pos = math.getPos2d(this.position, player.camera, $("#player")[0])
+            $("#hotPannel>div").css( { "left" : `${pos.pos.x}px`,  "top": `${pos.pos.y}px ` });
+            
+        }
+         
+        
         hot.prototype.showTitle = function(){
             if(!this.titleElem)return;
             var pos = math.getPos2d(this.position, player.camera, $("#player")[0])
@@ -15629,73 +15593,100 @@ window.Modernizr = function(n, e, t) {
             
         }
 		hot.prototype.examine = function(e, options) { 
-        
-            try{ 
-                window.parent.postMessage("clickHot",'*')
-               //$("#app .aside li" , parent.document)[0].click();
-            }catch(e){
-                console.log(e)
-            }
-        
-            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(); */
-                    
-                    var href = window.location.href
-                    var index =  href.indexOf("&")
-                    if(index>-1) href = href.substr(0,index)   /* pushState replaceState*/
-                    history.pushState(null, "", href+'&qs=1&firstView=pano:'+player.currentPano.id+',qua:'+ player.quaternion.toArray());
-                    window.location.href = src
+            options = options || {} 
+            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(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(); */
+                        
+                        var href = window.location.href
+                        var index =  href.indexOf("&")
+                        if(index>-1) href = href.substr(0,index)   /* pushState replaceState*/
+                        history.pushState(null, "", href+'&qs=1&firstView=pano:'+player.currentPano.id+',qua:'+ player.quaternion.toArray());
+                        window.location.href = src
+                        
+                        
+                    }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)
+                        
+                        
+                        //打开热点的时候把背景音乐关闭了,避免与热点里面的音乐冲突
+                        //g_bgAudio && g_bgAudio.pause();
+                        if(g_bgAudio && !g_bgAudio.paused){
+                            manage.switchBgmState(false); 
+                            g_bgAudio.pauseByHot = true
+                        } 
+                        if(g_tourAudio)g_tourAudio.pause()
+                        
+                        
+                        
+                    }
                     
                     
-                }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)
-                        }
-                        try{ 
-                            window.parent.postMessage("closeHot",'*') 
-                        }catch(e){
-                            console.log(e)
-                        }
-                    }  
                     
+                    return;
+                }
+            
+            
+                if(!player.currentPano)return;
+                
+                //获取那个热点的链接 
+                if(this.link){
+                    g_currentHot = this;		
+                    hotPop.style.display = "block";
+                    hotPop.classList.add("wait");
                     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)
-                    
-                    
-                    
                     //打开热点的时候把背景音乐关闭了,避免与热点里面的音乐冲突
                     //g_bgAudio && g_bgAudio.pause();
                     if(g_bgAudio && !g_bgAudio.paused){
@@ -15703,68 +15694,44 @@ window.Modernizr = function(n, e, t) {
                         g_bgAudio.pauseByHot = true
                     } 
                     if(g_tourAudio)g_tourAudio.pause()
-                }
-                
-                
-                
-                
-                return;
-            }
-        
-        
-            if(!player.currentPano)return;
-			var hotPop = document.getElementById('popup');
-            //获取那个热点的链接 
-			if(this.link){
-				g_currentHot = this;		
-				hotPop.style.display = "block";
-				hotPop.classList.add("wait");
-				var myElement = document.createElement("iframe");
-                //打开热点的时候把背景音乐关闭了,避免与热点里面的音乐冲突
-                //g_bgAudio && g_bgAudio.pause();
-                if(g_bgAudio && !g_bgAudio.paused){
-                    manage.switchBgmState(false); 
-                    g_bgAudio.pauseByHot = true
-                } 
-                if(g_tourAudio)g_tourAudio.pause()
-                
-                var src = getLink(this.link   )
-                myElement.src = src; 
-                myElement.id = "id1";
-				myElement.allowTransparency = "true";
-				// myElement.scrolling = "no";
-				var element=document.getElementById("id1");  //判断页面是否有iframe 
-				if (typeof(element)== "undefined" || element == null){
-                    document.querySelector(".popup-content").appendChild(myElement);
-                    //移动端自动播放
-                    var videoLoaddingResult = false
-                    window.loaddingSuccess = function() {
-                        videoLoaddingResult = true
-                    }
+                    
+                    var src = getLink(this.link   )
+                    myElement.src = src; 
+                    myElement.id = "id1";
+                    myElement.allowTransparency = "true";
+                    // myElement.scrolling = "no";
+                    var element=document.getElementById("id1");  //判断页面是否有iframe 
+                    if (typeof(element)== "undefined" || element == null){
+                        document.querySelector(".popup-content").appendChild(myElement);
+                        //移动端自动播放
+                        var videoLoaddingResult = false
+                        window.loaddingSuccess = function() {
+                            videoLoaddingResult = true
+                        }
 
-                    setTimeout(function func() {
-                        if (videoLoaddingResult) {
-                            var $iframe = document.querySelector('#id1').contentWindow.document;
-                            if($iframe.querySelector('video')){
-                                $iframe.querySelector('video').play();
-                                // alert($iframe.querySelector('video'));
-                                if(!$iframe.querySelector('video').paused && $iframe.querySelector('.playPause')){
-                                    $iframe.querySelector('.playPause').classList.add("fa-pause");
+                        setTimeout(function func() {
+                            if (videoLoaddingResult) {
+                                var $iframe = document.querySelector('#id1').contentWindow.document;
+                                if($iframe.querySelector('video')){
+                                    $iframe.querySelector('video').play();
+                                    // alert($iframe.querySelector('video'));
+                                    if(!$iframe.querySelector('video').paused && $iframe.querySelector('.playPause')){
+                                        $iframe.querySelector('.playPause').classList.add("fa-pause");
+                                    }
                                 }
+                                if($iframe.querySelector('audio')){
+                                    $iframe.querySelector('audio').play();
+                                }
+                            } else {
+                                setTimeout(func, 300)
                             }
-                            if($iframe.querySelector('audio')){
-                                $iframe.querySelector('audio').play();
-                            }
-                        } else {
-                            setTimeout(func, 300)
-                        }
-                    }, 800);
-				}  
-				
-				//setTimeout(function(){$('#player').on("click",e.closePopup);},20)
-				
+                        }, 800);
+                    }  
+                    
+                    //setTimeout(function(){$('#player').on("click",e.closePopup);},20)
+                    
+                }
 			}
-			
             // if(hotListSta) {
             //     hotPop.classList.remove("wait"); 
             //     return;
@@ -15777,7 +15744,7 @@ window.Modernizr = function(n, e, t) {
 			var o = function() {
 				e.flyingToTag = false;
 				if(this.link){ 
-					hotPop.classList.remove("wait"); 
+					hotPop && hotPop.classList.remove("wait"); 
 				}
 				
 			}.bind(this);
@@ -17688,8 +17655,9 @@ window.Modernizr = function(n, e, t) {
 				
 
             n.prototype.loadOverlays = function(overlays){
-                var overlays = window.data2 && window.data2.overlays   
-                overlays = [{"media":["text"],"depth":0.02,"file":"https://super.4dage.com/data/791/edit/20210128_141321391.jpg","pos":[-37.601, 7.533, 14.007],"hasBox":0,"width":6.5705,"qua":[0, 0.6942, 0, 0.7198],"height":3.5873,"sid":"1611814305459"},{"media":["photo"],"depth":0.02,"file":"images/textbg.jpg","pos":[-37.601, 7.533, 14.007],"hasBox":0,"width":6.5705,"qua":[0, 0.6942, 0, 0.7198],"height":3.5873,"sid":"1611814305459"}]
+                var overlays = window.data2 && window.data2.overlays  
+                  
+                
                 overlays && overlays.forEach((info)=>{ 
                     new Overlay(info)  
                 })
@@ -20418,16 +20386,16 @@ window.Modernizr = function(n, e, t) {
                 p.start(u, i, h, 0, d.easeInOutQuad, "wait")
 
                 //zoom动画
-
+                //这是啥?
                 var currentGuide = player.model.heroLocations[app.director.currentItem];
-                
-                this.player.zoomEnabled = true;
-                var zoom = function(e, d) { 
-                    this.player.zoomTo(e * currentGuide.zoom.toFixed(2), true)        
+                if(currentGuide.zoom){
+                    this.player.zoomEnabled = true;
+                    var zoom = function(e, d) { 
+                        this.player.zoomTo(e * currentGuide.zoom.toFixed(2), true)        
 
-                }.bind(this)
-                p.start(zoom, 2000, null, 0, d.easeOutQuad, "zoom")
-                
+                    }.bind(this)
+                    p.start(zoom, 2000, null, 0, d.easeOutQuad, "zoom")
+                }
             }
             ,
             n.prototype.warpToNonPano = function(e) {
@@ -21502,18 +21470,12 @@ window.Modernizr = function(n, e, t) {
                     manage.switchBgmState(true)
                 }
                 
-                try{ 
-                    window.parent.postMessage("closeHot",'*') 
-                }catch(e){
-                    console.log(e)
-                }
+                
 				//$('#player').off("click",this.closePopup);
                 return false
 			}  
 				 
 			 
-              
-             
 			
             n.prototype.setupCustomProperties = function(e) {
                 var t = e || u.PANORAMA;
@@ -21911,7 +21873,7 @@ window.Modernizr = function(n, e, t) {
                         
                     if (this.cameraControls.activeControl && this.cameraControls.activeControl.emit(_.Move, this.isTouchEvent ? "touch" : "mouse"),
                     this.history.invalidate(),
-                    this.intersect)
+                    this.intersect && (this.mode == "panorama" || !window.MP_PREFETCHED_MODELDATA.flyInOnlyBySwitch))// 改
                         return this.flyToPanoClosestToMouse();
                     if (this.mode === u.PANORAMA) {
                         var n = this.closestPanoInDirection(this.getMouseDirection());
@@ -21949,7 +21911,7 @@ window.Modernizr = function(n, e, t) {
                  //-------------------
                 window.initOverlay(r)
                 this.model.loadOverlays() 
-                createEnterLogo() 
+                 
                 //-------------------
                 
                 
@@ -21999,6 +21961,13 @@ window.Modernizr = function(n, e, t) {
                     if (this.checkAndWaitForPanoLoad(e, "high", "low", this.basePanoSize, a))
                         return
                 }
+                
+                
+                //add
+                this.transitionPos({type:"beforeFlytopano", pano:this.currentPano, dur:0})
+                
+                
+                
                 return this.mode = u.PANORAMA,
                 e.floor.enter(this.mode),
                 this.emit(w.PanoChosen, this.currentPano, this.currentPano),
@@ -22521,14 +22490,6 @@ window.Modernizr = function(n, e, t) {
                 if(overlay.overlayType == "video"){
                     if(plane.material.map.image.paused)plane.material.map.image.play()
                     else plane.material.map.image.pause();
-                }else if(overlay == enterObjects){//add
-                    //window.location.href = "http://www.4dmodel.com/SuperTwo762/index.html?m=762&qust=1"
-                    try{ 
-                        window.parent.postMessage("goInside",'*')
-                       //$("#app .aside li" , parent.document)[0].click();
-                    }catch(e){
-                        console.log(e)
-                    }
                 }
                 
                /*  if(window.EditOverlay &&EditOverlay.editing){
@@ -22658,11 +22619,18 @@ window.Modernizr = function(n, e, t) {
             n.prototype.fitDollhouse = function(e, t, i) {//许钟文改   飞入前寻找和初始视角最合适的位置
 				//if(urlHasValue('oldEntry')){
 					//搬自一代。
-					var n = d.FORWARD.clone().applyQuaternion(i)
+                    var maxY = this.model.boundingBox.max.y;
+					  var n = d.FORWARD.clone().applyQuaternion(i)
 					  , i = n.clone().add(e); 
 					this.cameraControls.activeControl.target.copy(i),
-					this.cameraControls.activeControl.camera.position.set(0, 6, 0).add(e).add(n.multiplyScalar(-10)) 
-					//return;	
+					this.cameraControls.activeControl.camera.position.set(0, maxY * 2.4, 0).add(e).add(n.multiplyScalar(-10)) 
+					//return;	  
+                    
+                    /* //this.camera.position.copy(this.model.center);
+                    //this.camera.updateMatrixWorld()
+                    this.switchCameraMode("dollhouse", i) */
+                    
+                    
 					
 				//}//下面是二代代码,看不太懂。因为有的场景在靠近一端的某个方向截取的初始视角会甩镜头,也就是不是下去之后的方向
                //直接用一代的这个 效果和二代几乎一样,且不会甩
@@ -22841,6 +22809,9 @@ window.Modernizr = function(n, e, t) {
                     
                      //---------before fly--------------- add
                     this.updateHotVisible(i); //更新热点显示
+                    this.transitionPos({type:"beforeFlytopano", pano:i, dur:I})//add 
+                    
+                    
                     //地标变化
                     if(this.model.floorLogos){
                         this.model.changefloorLogoOpa({index:0, opa:0, dur: p, delay:0.7})//this.model.floorLogoFade(0, _duration*0.5, 0.7);  
@@ -22882,42 +22853,65 @@ window.Modernizr = function(n, e, t) {
                             this.model.floorLogos[0].position.copy(this.model.floorLogos[1].position)
                             //this.model.adjustfloorLogoHeight()
                             this.model.changefloorLogoOpa({index:0,opa:1,dur:0});//this.model.floorLogos[0].material.uniforms.opacity.value = 1;
-                            this.model.floorLogos[1].visible = false; 
+                            this.model.floorLogos[1].visible = false;
                         }
-                        /* if(this.mode == "panorama"){
-                            updateEntryShowing()
-                             
-                        } */
                     }
                     .bind(this), 0, B, "camFly", V.FlyToPano)
                 }
             }
             ,
             
-            n.prototype.controlEntryOpacity = function(o){//add
+            
+            
+            window._transitionPosId = 9999
+            
+            n.prototype.transitionPos = function(o={}) {//渐变overlay和热点的位置
+            
+                y.cancelById(_transitionPosId)
                   
-                if(o.entryShowing!=void 0) entryShowing = o.entryShowing 
-                 
-               
-                var startOpa = enterObjects.children[0].material.opacity;
-                var aimOpa = o.on ? 1 : entryShowing ?  0.3 : 0
-                if(startOpa == aimOpa)return;
-                
-                y.cancelById(_entryOpacityId); 
-                y.start((progress)=>{ 
-                    var opa = startOpa * (1-progress) + aimOpa * progress
-                    enterObjects.children.forEach(plane=>{
-                        plane.material.opacity = opa
-                    })    
-                }, 1500, ()=>{//done
-                    if(entryShowing){
-                        this.controlEntryOpacity({on:!o.on})
-                    } 
-                }, 0, A[f.transition.movementEasing], null, _entryOpacityId);
-                
-                
+                var begin = function(object, pos, qua, scale){ 
+                    if(pos){
+                        if(!same(object.position, pos, 0.01)){
+                              
+                            y.start(v.vector(object.position, pos), o.dur, (e)=>{
+                                
+                            },0, A[f.transition.movementEasing], "transitionPos", _transitionPosId)
+                        }    
+                        
+                        if(!same(object.quaternion, qua, 1e-6)){
+                            y.start(v.quaternion(object.quaternion, qua), o.dur, (e)=>{
+                                
+                            },0, A[f.transition.movementEasing], "transitionPos", _transitionPosId)
+                        }
+                        
+                        
+                        if(!same(object.scale, scale, 0.001)){ 
+                            y.start(v.vector(object.scale, scale), o.dur, (e)=>{
+                                
+                            },0, A[f.transition.movementEasing], "transitionPos", _transitionPosId)
+                        }   
+                        
+                        
+                    }
+                }
+                var same = function(vec1, vec2, diff){ 
+                    var s = Math.abs(vec1.x-vec2.x) < diff && Math.abs(vec1.y-vec2.y) < diff && Math.abs(vec1.z-vec2.z) < diff 
+                    if(s && vec1.w) s = Math.abs(vec1.w-vec2.w) < diff 
+                    return s
+                }
+                this.overlayGroup.children.forEach(overlay=>{
+                    var panoData = o.pano != void 0 && overlay.transformAtPanos[o.pano.id]
+                    var useCustom = o.type == "beforeFlyOut" || !panoData
+                    var pos = useCustom ? overlay.posCustom : panoData.pos;
+                    var qua = useCustom ? overlay.quaCustom : panoData.qua;
+                    var scale = useCustom ? overlay.getScaleBySize(overlay.widthCustom, overlay.heightCustom) :  
+                                overlay.getScaleBySize(panoData.width , panoData.height)
+                        scale = new THREE.Vector3(scale.x, scale.y, overlay.scale.z)        
+                    begin(overlay, pos, qua, scale  )
+                    
+                })
+            
             }
-   
             
             
             n.prototype.fastForwardActivePanoFlight = function(e) {
@@ -23229,6 +23223,12 @@ window.Modernizr = function(n, e, t) {
                     }
                 }
                 
+                if(i == "panorama"){  
+                    this.transitionPos({type:"beforeFlyIn", pano:n, dur:I})//add                     
+                }else{  
+                    this.transitionPos({type:"beforeFlyOut",  dur:I/2})//add                       
+                }
+                
                 //------------------------------------
                 
                 
@@ -23330,10 +23330,8 @@ window.Modernizr = function(n, e, t) {
                         this.model.changefloorLogoOpa({index:0, from:0, opa:1, dur: 150 }),//this.model.floorLogoShow(0,150);
                         this.model.floorLogos[0].visible = true
                     )
-                    /* if(this.mode == u.PANORAMA) updateEntryShowing()
-                    else player.controlEntryOpacity({on:false, entryShowing:false}) */
-                    //-------
-                
+                    
+                    
                     h && p !== u.PANORAMA && i === u.PANORAMA ? this.startWarp(b.Retain, E.Retain, x.BLACK, null, null, s) : (s && s(),
                     t.resolve())
                 }
@@ -26169,7 +26167,7 @@ window.Modernizr = function(n, e, t) {
             panAccelerationOutside: 60,
             onload: r.valueFromHash("onload", o.PANORAMA),
             zoomNearLimit: .1,
-            zoomFarLimit: 30,
+            zoomFarLimit: 10,
             navigation: {
                 panoScores: !1,
                 mouseDirection: !0,
@@ -30029,6 +30027,35 @@ window.Modernizr = function(n, e, t) {
             "use strict";
             function n(e, t) {
                 var i = r(t);
+                 
+                
+                var replaceAll = function (str, f, e) {
+                  //f全部替换成e
+                  var reg = new RegExp(f, "g"); //创建正则RegExp对象   
+                  return str.replace(reg, e);
+                }; 
+                var urlFirstView = c.valueFromHash('firstView');
+                if(urlFirstView){
+                    try{  
+                        urlFirstView = replaceAll(urlFirstView, "pano", '"pano"')  
+                        urlFirstView = replaceAll(urlFirstView, "qua:", '"qua":[') 
+                        urlFirstView = "{"+urlFirstView+"]}"
+                        let info = JSON.parse(urlFirstView);   
+                        i.pano = t.list[info.pano] //panos.get(info.pano)
+                        if(!i.pano){
+                            urlFirstView = false
+                            console.error('检测到firstView但是 找不到该pano')
+                        }else{
+                            i.quaternion = new THREE.Quaternion().fromArray(info.qua)
+                            i.zoom = -1;
+                            i.mode = "panorama"
+                            i.setByUrl = true
+                        } 
+                    }catch(e){
+                        urlFirstView = false
+                        console.error('检测到firstView但是解析出错'+e)
+                    } 
+                }
                 if (Object.keys(i).length > 0)
                     return i;
                 if (e.heroImage)

+ 54 - 189
js/overlay.js

@@ -1,7 +1,4 @@
  
- 
- 
- 
 var initOverlay = function(THREE){
     var _planeGeometry = new THREE.PlaneGeometry(settings.overlay.width, settings.overlay.height,1,1)
     var _boxGeometry = new THREE.BoxBufferGeometry(settings.overlay.width, settings.overlay.height, settings.overlay.depth )
@@ -24,14 +21,14 @@ var initOverlay = function(THREE){
     var Overlay = function(info){ 
         THREE.Object3D.call(this); 
         this.sid = info.sid;
-        // if(info.media)this.preDeal(info)  
+        if(info.media)this.preDeal(info) 
         this.build(info);
         this.name = "overlay_"+this.sid;
     }
     Overlay.prototype = Object.create(THREE.Object3D.prototype);
     
     Overlay.prototype.build = function(info){
-        if( info.media.includes('text') && !info.words)return;
+        
         var plane = new THREE.Mesh(_planeGeometry, new THREE.MeshBasicMaterial({//MeshStandardMaterial
             color:"#00c8af",
             opacity:0.4,
@@ -48,10 +45,6 @@ var initOverlay = function(THREE){
         }   
         overlayGroup.add(this);
         
-        
-        
-        
-        
         if(info.media){ 
             if(info.media.includes('video')){
                 var video = $('<video controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>')[0]
@@ -72,47 +65,10 @@ var initOverlay = function(THREE){
                  
                 img.src = manage.dealURL(info.file) //"https://4dkk.4dage.com/images/images"+Config.projectNum+"/overlay"+this.sid+".jpg?m="+new Date().getTime()
                 info.media = img
-                 */ 
-                info.type = "photo"  
-                
-            }else if(info.media.includes('text')){
-                info.type = "text";
+                 */
                 
-                var fontSize = 40;
-                var lineHeight = fontSize * 2.1;//fontSize + 行间距
-                var texWidthRitio = 0.86  
-                var canvas = document.createElement('canvas');  
-                var context = canvas.getContext('2d');
-                canvas.width = 1024; 
-                context.font =  `${fontSize}px 微软雅黑`;     
-                 
-                var result = []
-
-                info.words.forEach((words)=>{
-                    if(!words){result.push("");return;}
-                    result = result.concat ( breakLinesForCanvas(
-                        words,
-                        //'使用很寻常的二分查找,如果某一个位置之前的文字宽度小于等于设定的宽度,并且它之后一个字之前的文字宽度大于设定的宽度,那么这个位置就是文本的换行点。上面只是找到一个换行点,对于输入的一段文本,需要循环查找,直到不存在这样的换行点为止, 完整的代码如下',
-                        context, canvas.width * texWidthRitio ) )
-                })
-
+                info.type = "photo"  
                 
-               
-                canvas.height = (result.length + 1 ) * lineHeight  
-                var context = canvas.getContext('2d');//不知为什么要再获取一次context才行
-                context.font =  `${fontSize}px 微软雅黑`;     
-                /* context.fillStyle = '#fff';
-                context.fillRect(0,0,canvas.width,canvas.height); */
-                context.fillStyle = '#f5c772';
-                result.forEach(function(line, index) {
-                    context.fillText(line, canvas.width * (1-texWidthRitio)/ 2, lineHeight * (index + 1));
-                });
-
-                var url = canvas.toDataURL()    
-                var img = new Image();
-                img.src = url;
-                info.media = img;
-                info.lineCount = result.length
             }
             plane.material.opacity = 1;
             plane.material.color = new THREE.Color(1,1,1) 
@@ -124,61 +80,43 @@ var initOverlay = function(THREE){
         
     }
 
-    Overlay.prototype.computeMapRepeat = function(info){//使得文字不变形
-        clearInterval(this.mapInterval);
-        var map = this.plane.material.map;
-        var tw = map.image.width,  th = map.image.height,
-            w = this.width, h = this.height;
-            
-        var ratio = (h / w) / (th / tw); //显示的部分占据整个图高度的比例 
-        map.repeat.y = ratio    
-        if(th / tw > h / w){ 
-            //如果贴图设置成不repeat(缺点是会有一段白屏期)
-            /* map.offset.y = 1 - ratio;//向下移动 1-ratio个高度, 使图片的顶部显示在plane的最上方;之后滚动时正常repeat在 1-ratio到0之间变化 , 为了连续变化,改成 1 到 -ratio
-            this.mapInterval = setInterval(()=>{
-                map.offset.y -= 0.003;
-                if(map.offset.y < -ratio )map.offset.y = 1
-            },20) */
-               
-            //如果贴图设置成 repeat(缺点是 可能衔接时的缝隙比较窄)
-            map.wrapS = map.wrapT = THREE.RepeatWrapping; 
-            map.offset.y = 1 - ratio;//向下移动 1-ratio个高度, 使图片的顶部显示在plane的最上方;之后滚动时正常repeat在 1-ratio到0之间变化 , 为了连续变化,改成 1 到 -ratio
-            this.mapInterval = setInterval(()=>{
-                map.offset.y -= 0.013 / info.lineCount ;
-                //if(map.offset.y < -ratio )map.offset.y = 1
-            },20)  
-            
-        }else{//如果图可以完全展示
-            map.offset.y = (1 - ratio) / 2;//居中
-            map.wrapS = map.wrapT = THREE.ClampToEdgeWrapping;
-            
-        }
-        map.needsUpdate = true;
-    }
+     
       
     Overlay.prototype.setFromInfo = function(info){//1 恢复到编辑之前 2 初始加载 
-        var plane = this.plane;
-        info.width && (this.scale.setX(info.width/settings.overlay.width),this.width = info.width)
-        info.height && (this.scale.setY(info.height/settings.overlay.height),this.height = info.height) 
+        var plane = this.plane; 
+        this.transformAtPanos = info.transformAtPanos || {} //在每个漫游点独立设置的position。  
+        var curPanoTransform = player.currentPano && this.transformAtPanos[player.currentPano.id] || {} 
+        
         info.depth && this.scale.setZ(info.depth/settings.overlay.depth)
-        info.pos && this.position.copy(info.pos);
-        info.qua && this.quaternion.copy(info.qua);
+        
+         
+        this.posCustom = info.pos ? info.pos.clone() : this.position.clone(); //没有单独设置position的漫游点使用的position
+        this.position.copy(curPanoTransform.pos || this.posCustom )
+        
+        this.quaCustom = info.qua ? info.qua.clone() : this.quaternion.clone()
+        this.quaternion.copy(curPanoTransform.qua || this.quaCustom);
+        
+        
+        this.widthCustom = info.width  
+        this.heightCustom = info.height  
+        this.width = curPanoTransform.width || this.widthCustom
+        this.height = curPanoTransform.height || this.heightCustom
+        var a = this.getScaleBySize(this.width, this.height)
+        this.scale.setX( a.x )
+        this.scale.setY( a.y )
+        
+        
+        
+        
         if(info.type){
             if(!plane.material.map){
                 if(info.type == "video"){ 
                     plane.material.map = new THREE.VideoTexture( info.media );  
-                }else if(info.type == "photo"){   
+                }else{  
                     plane.material.map = Texture.load(info.file,()=>{
                         if(this._loadDone)this._loadDone()
                     }) 
-                }else{
-                    plane.material.map = new THREE.Texture;
-                    plane.material.map.image = info.media;
-                    info.media.onload = ()=>{
-                        plane.material.map.needsUpdate = true
-                        this.computeMapRepeat(info)
-                    }
-                }                    
+                } 
                 plane.material.map.wrapS = plane.material.map.wrapT = THREE.ClampToEdgeWrapping;
                 plane.material.map.minFilter = THREE.LinearFilter;
                 plane.material.map.magFilter = THREE.LinearFilter;
@@ -191,6 +129,9 @@ var initOverlay = function(THREE){
         if(!!this.hasBox != !!info.hasBox){
             this.addBox(!this.hasBox); 
         }
+        
+        
+        
     } 
 
     Overlay.prototype.addBox = function(state){
@@ -213,9 +154,18 @@ var initOverlay = function(THREE){
         this.hasBox = state
     }
     
-    
-    
-    
+    Overlay.prototype.getSizeByScale = function(){ 
+        return {
+            width : settings.overlay.width * this.scale.x,
+            height : settings.overlay.height * this.scale.y
+        }
+    }
+    Overlay.prototype.getScaleBySize = function(width, height){ 
+        return {
+            x : width / settings.overlay.width,
+            y : height / settings.overlay.height,
+        }  
+    } 
     
     Overlay.prototype.preDeal = function(info){
         info.pos = new THREE.Vector3().fromArray(info.pos)
@@ -231,102 +181,17 @@ var initOverlay = function(THREE){
         info.qua.y = parseFloat(info.qua.y)
         info.qua.z = parseFloat(info.qua.z)
         info.qua.w = parseFloat(info.qua.w)
-
-        if(info.media.includes("text")){ 
-            /* 
-                只有http能加载
-             */
-            $.ajax({ 
-                url: "http://192.168.0.44:8110/api/web/list",
-                type: 'POST',
-                dataType: "json", 
-                headers: {
-                    //'Content-Type': 'application/json',
-                    token: "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOm51bGwsIm1hbmFnZXIiOm51bGwsImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjExODE1NDQ5LCJpYXQiOjE2MTE3MjkwNDksImp0aSI6IjMxYjllN2IxLTUxYTYtNDgzZS04OGFhLTQwMzA4Y2M3YmU5ZiJ9.aSmiucG9u6ny7BdMOuHUBYO8K1_7ElLKwPCzmoVRKtI"
-                },
-                cache: false, 
-                contentType: 'application/json;charset=UTF-8',
-                data : JSON.stringify({"pageNum":1,"pageSize":1000,"rnd":0.1276922704592891} ),
+        
+        if(!info.transformAtPanos)info.transformAtPanos = {}
+               
+        for(let i in info.transformAtPanos){
+            info.transformAtPanos[i].pos = new THREE.Vector3().fromArray(info.transformAtPanos[i].pos)
+            info.transformAtPanos[i].qua = new THREE.Quaternion().fromArray(info.transformAtPanos[i].qua)
                 
-                success: (data)=>{ 
-                    console.log(data)
-                    var words = [];
-                    data.data.list.forEach((item,index)=>{
-                        /* words += item.nickName; words += "  "
-                        words += item.createTime; words += "\n\n"  
-                        words += item.msg; words += "\n"
-                        words += "————————\n\n"  */
-
-                        words.push(item.nickName + " " + item.createTime);
-                        //words.push("");
-                        words.push(item.msg);
-                        words.push("————————————————");
-                        words.push("");
-          
-                    })
-                    console.log(words)
-                    info.words = words 
-                    this.build(info)
-                },
-                error: function (msg) {
-                    console.log(msg)
-                }
-            });
-              
-
         }
+        
     }
-   
-
-
-
-
-
-    function findBreakPoint(text, width, context) {
-        var min = 0;
-        var max = text.length - 1;
-
-        while (min <= max) {
-            var middle = Math.floor((min + max) / 2);
-            var middleWidth = context.measureText(text.substr(0, middle)).width;
-            var oneCharWiderThanMiddleWidth = context.measureText(text.substr(0, middle + 1)).width;
-            if (middleWidth <= width && oneCharWiderThanMiddleWidth > width) {
-                return middle;
-            }
-            if (middleWidth < width) {
-                min = middle + 1;
-            } else {
-                max = middle - 1;
-            }
-        }
-
-        return -1;
-    }
-
-    function breakLinesForCanvas(text, context, width, font) {  
-        var result = [];
-        var breakPoint = 0;
-
-        if (font) {
-            context.font = font;
-        }
-
-        while ((breakPoint = findBreakPoint(text, width, context)) !== -1) {
-            result.push(text.substr(0, breakPoint));
-            text = text.substr(breakPoint);
-        }
-
-        if (text) {
-            result.push(text);
-        }
-
-        return result;
-    }
-
-
-
-
-   
+    
     
     window.Overlay = Overlay;
 }