xzw пре 3 недеља
родитељ
комит
00e38718fc
6 измењених фајлова са 128 додато и 48 уклоњено
  1. 11 0
      edit.html
  2. 54 20
      js/Hot.js
  3. 48 16
      js/edit.js
  4. 1 1
      js/main_2020_edit.js
  5. 13 10
      js/main_2020_show.js
  6. 1 1
      js/manage.js

+ 11 - 0
edit.html

@@ -1236,6 +1236,17 @@
                                             </div>
                                         </div>
                                     </li> 
+                                    <li name="autoOpen">  
+                                        <ul id="autoOpen" class="switch clearfix hotStyle-item colorWrap">
+                                            <label><input class="mui-switch mui-switch-animbg" type="checkbox">
+                                                 <span>自动打开 </span>
+                                            </label> 
+                                        </ul>
+                                        <label name='panoId' class="remark hide" style='word-break: break-all;'>在点位 <span>1</span> 处大致朝向热点时打开 <img name='btn' src='images/coordinate.png' title='点击跳转到该点位' style="cursor: pointer; background:#fff5ad;padding:2px;width:15px;border-radius: 3px;"></img></label> 
+                                    </li> 
+                                    
+                                    
+                                    
                                     </ul>
                                 </li>
                                  

+ 54 - 20
js/Hot.js

@@ -1,6 +1,6 @@
  
 //合并热点和展览 
-g_currentHot = null
+let currentOpenHot = null
 
 
 
@@ -17,7 +17,7 @@ const playSyncGroup = [//需要播放同步的视频。  每次都单独定制
    // ['okh1UR466371',  'LGmLHP2615503' ,  'VNyBI6614896'] //中,左,右   场景SHANGJJ
 ]
  
-
+let lastOpen = {closeTime: -10000}
 
 window.initHot = function(model){
       
@@ -136,20 +136,19 @@ window.initHot = function(model){
     }
 
  
-    const ctlBtns = {
+    /* const ctlBtns = {
         play : Texture.load('images/soundPlay.png') ,
         pause: Texture.load('images/soundPause.png') 
     } 
      
     const ctlBtn = new THREE.Mesh(_planeGeometry,new THREE.MeshBasicMaterial({map:ctlBtns.pause, depthTest:false,  transparent:true}))
     ctlBtn.name = 'ctlBtn'
-    ctlBtn.renderOrder = 5
-    
+    ctlBtn.renderOrder = 5 
+
+    window.ctlBtn = ctlBtn */
     
     
     
-
-window.ctlBtn = ctlBtn
     
     class Hot extends THREE.Object3D{
         constructor(info, source){    
@@ -1113,6 +1112,7 @@ window.ctlBtn = ctlBtn
             
             this.updateScale()
             this.updateTitle()
+             
         }
                     
         updateScale(e, t) {//自适应调节大小   
@@ -1157,9 +1157,9 @@ window.ctlBtn = ctlBtn
                 if(state == 'stop'){
                     video.currentTime = 0; 
                 }  
-                if(this.sid == 'LezWqUp088015'){
+                /* if(this.sid == 'LezWqUp088015'){
                     ctlBtn.material.map = ctlBtns.play
-                }
+                } */
             }else if(state){
                 if(/* !isVideoPlayed(video) */  video.paused  ){
                      console.log({str: 'videoControl play ' +", "+ this.sid,  level:1})
@@ -1171,9 +1171,9 @@ window.ctlBtn = ctlBtn
                     //video.currentTime = video.lastCurTime || 0
                     this.changeOpaWhenPlay(video)
                     
-                    if(this.sid == 'LezWqUp088015'){
+                    /* if(this.sid == 'LezWqUp088015'){
                         ctlBtn.material.map = ctlBtns.pause
-                    }
+                    } */
                     
                     //处理同步播放
                     let group = playSyncGroup.find(e=>e.includes(this.sid))
@@ -1262,7 +1262,7 @@ window.ctlBtn = ctlBtn
             this.titleElem.setVisible(v, 'hoveredVisi', 1)
             //this.updateTitle()  
             
-            if(this.sid == 'LezWqUp088015'){
+            /* if(this.sid == 'LezWqUp088015'){
                 if(state){
                     this.add(ctlBtn)    //显示按钮
                     let scale = 0.8
@@ -1272,7 +1272,7 @@ window.ctlBtn = ctlBtn
                 }else{
                     this.remove(ctlBtn)
                 } 
-            }
+            } */
         }
         
        
@@ -1360,7 +1360,7 @@ window.ctlBtn = ctlBtn
         
         examine(options={}) {
             var openHot = this.info.link && this.info.actionType.openHot && !options.dontOpen
-            var fastTran = !options.dontFastTran && ( this.info.actionType.fastTran || settings.hotFastTran || options.fastTran)
+            var fastTran = !options.isOpenAuto && !options.dontFastTran && ( this.info.actionType.fastTran || settings.hotFastTran || options.fastTran)
             if(fastTran){//瞬间过渡 1到固定方位 2到和普通过渡一样的位置,也就是最适合的位置 
                 let info = this.info.cameraData  
                 if(info){
@@ -1380,7 +1380,7 @@ window.ctlBtn = ctlBtn
             
             
             
-            var needExamine = !fastTran && (options.examine || (!settings.dontExamHot && this.info.actionType.examine))
+            var needExamine = !fastTran && !options.isOpenAuto && (options.examine || (!settings.dontExamHot && this.info.actionType.examine))
             if(!openHot && !needExamine)return;
             
             
@@ -1445,11 +1445,13 @@ window.ctlBtn = ctlBtn
             var popup = document.getElementById("popup");
             
             if (openHot) {
-                g_currentHot = this,
+                currentOpenHot = this,
                 popup.style.display = "block",
                 popup.classList.add("wait");
                 var n = document.createElement("iframe");
-                 
+                /* if(options.isOpenAuto){
+                    n.style['pointer-events'] = "none";
+                } */
                 SoundManager.play('hot')
                 
                 var src = getLink(this.info.link   )
@@ -1954,8 +1956,9 @@ window.ctlBtn = ctlBtn
      
     
     Hot.closePopup = ()=>{// 关闭热点页面
-        if(!g_currentHot) return;
-        g_currentHot = null;
+        if(!currentOpenHot) return;
+        lastOpen.hot = currentOpenHot, lastOpen.closeTime = Date.now()
+        currentOpenHot = null;
         var hotPop = document.getElementById('popup'); 
             hotPop.style.display = "none";
         document.querySelector(".popup-content").removeChild(document.getElementById("id1"));
@@ -1964,7 +1967,7 @@ window.ctlBtn = ctlBtn
         
         SoundManager.pause('hot', true)//自动播放被中断的音频 (bgm
         
-         
+      
         return false
     }  
         
@@ -2131,6 +2134,37 @@ window.ctlBtn = ctlBtn
              
         },  800) 
         
+        
+        
+        if(!currentOpenHot && player.mode == 'panorama' && !player.flying && (!window.isEdit || editTool.atPanel != 'hotpoint')){//open auto
+            let hots = hotGroup.children.filter(hot=>hot.info.autoOpenPanoId == player.currentPano.id && hot.info.actionType.openHot )
+            let cosMap = new Map 
+            let camDir = player.getDirection()
+            const minCos = 0.985
+            hots = hots.filter(hot=>{
+                let vec = hot.getWorldCenter().sub(player.position).normalize()
+                let cos = vec.dot(camDir)
+                if(cos > minCos){
+                    cosMap.set(hot, cos)
+                    return true
+                } 
+            })
+            hots.sort((a,b)=>{return cosMap.get(b) - cosMap.get(a)})
+            let centerHot = hots[0]
+            
+            if(centerHot){
+                let now = Date.now(), pastTime = now - lastOpen.closeTime, minSpaceTime = lastOpen.hot == hot ? 5000 : 3000 //同一个的弹出间隔时间长于不同的
+                if(pastTime > minSpaceTime){ 
+                    centerHot.examine({ isOpenAuto:true})
+                    lastOpen.hot = centerHot 
+                } 
+            }
+            
+        }
+        
+       
+        
+        
     }
     
 }

+ 48 - 16
js/edit.js

@@ -1243,11 +1243,7 @@ Hotpoint.prototype.init = function() {
     })
     
     
-    
-    
-    
-    
-    
+     
     
     this.isSpriteCheckBox = new CheckBox({dom:  $("#isSprite"),
         uiCallBack : (checked)=>{ 
@@ -1279,6 +1275,25 @@ Hotpoint.prototype.init = function() {
             
         }
     })
+    
+    
+    this.autoOpenCheckBox = new CheckBox({dom: $('#autoOpen input') ,
+        uiCallBack : (checked, name)=>{ 
+            let label = $('#hotpointDetail [name=autoOpen] [name=panoId]')
+            checked ? label.removeClass('hide') : label.addClass('hide')
+            $('#autoOpen span').text(checked ? '自动打开' : '在当前点位自动打开')  
+            setTimeout(()=>{
+                checked && label.find('span').text(this.editSpot.info.autoOpenPanoId ) 
+            },1)
+        },
+        callbackWhenChose:(checked, name)=>{ 
+            this.editSpot.info.autoOpenPanoId = checked ? player.currentPano.id : null 
+            $('#autoOpen span').text(checked ? '自动打开' : '在当前点位自动打开')  
+        }
+    })
+    
+    
+    
  
     this.imgDescCheckBox = new CheckBox({dom:  this.hotpointDetail.find("#addImgDesc"),
         uiCallBack : (checked, name)=>{ 
@@ -1446,6 +1461,12 @@ Hotpoint.prototype.init = function() {
         }
     })
     
+    
+    
+    
+    
+    
+    
     /* $('#setPosForPano input').on("change", ()=>{
         var on = $('#setPosForPano input').is(':checked') 
         if(!on){
@@ -1879,11 +1900,14 @@ Hotpoint.prototype.editHot = function(hot, $li) {
     this.videoDescCheckBox.updateChoseAtUI(this.editSpot.info.useVideoDesc)
     
     this.linkTypeMenuOptions.updateChoseAtUI({name:this.editSpot.info.linkType})
-     
+    this.autoOpenCheckBox.updateChoseAtUI(this.editSpot.info.autoOpenPanoId == void 0 ? false : true) 
      
     this.updateClickEventUI();//根据actionType更新ui
     
-     
+    $('#hotpointDetail li[name=autoOpen] img[name=btn]').on('click',(e)=>{//定位
+        let pano = player.model.panos.index[this.editSpot.info.autoOpenPanoId]
+        player.flyToPano({pano})
+    })
       
     var iframesHTML = hot.info.iframe.map(function(iframe) {
         return this.inputList("请填写网页链接", iframe)
@@ -2107,10 +2131,12 @@ Hotpoint.prototype.findSpotByContent = (media, type)=>{////使用了该贴图的
     var spots = []
     
     if(type == 'shine'){
-        media = media || []
+        media = media || [] 
+        
         for(var i in player.model.hots){ 
             if(player.model.hots[i].texType != type)continue
-            var styleImg = player.model.hots[i].styleImg || [];
+            var styleImg = player.model.hots[i].styleImg?.length ? player.model.hots[i].styleImg : Object.values(g_HotImage).map(e=>{return {src:e}});
+            
             if(ifSameTex(styleImg,	media)){
                 spots.push(player.model.hots[i])
             }
@@ -2166,7 +2192,7 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
         }  
     }
      
-    var hotIcons = [];  // 从所有热点tex中搜集 。
+    var hotIcons = [ Object.values(g_HotImage)];  // 从所有热点tex中搜集 。  g_HotImage是默认
     player.model.hotGroup.children.forEach(e=>{// 从所有热点tex中搜集
         if(e.texType == 'shine'){
             let imgs = e.info.styleImg;
@@ -2177,10 +2203,9 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
             }
         } 
     })
-      
-    hotIcons = hotIcons.map(imgs=>imgs = imgs.map((a)=>{return {src:a}})) 
-    //hotIcons = [[], [g_HotImage.point, g_HotImage.point2], ...hotIcons] 
-    hotIcons.push([{src:g_HotImage.point}, {src:g_HotImage.point2}],[] )//放末尾用来添加的  g_HotImage是默认
+    hotIcons = [...hotIcons.slice(1),  hotIcons[0]]//默认的放最后, 这样添加完在列表最前 
+    hotIcons = hotIcons.map(imgs=>imgs = imgs.map((a)=>{return {src:a}}))  
+    hotIcons.push( [] )//放末尾用来添加的  
     
     var list = hotIcons.map(arr=>{//初始列表
         var elem = getListItem()
@@ -2192,7 +2217,7 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
         arr.length && elem.find("li").eq(1).removeClass('hide') 
         return elem 
     })
-    list[list.length - 2].addClass('forbitEdit') 
+    list[0].addClass('forbitEdit')   //list[list.length - 2].addClass('forbitEdit') 
      
      
     this.styleList = new ListBox(list,  $('#shineTexSelect'), {//列表
@@ -2220,7 +2245,8 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
                 o.dontApplyToHot || this.editSpot.changeShineTex(imgs)  
             }
             
-            Array.from(this.styleList.listDom.children()).forEach(li=>{//更新一下所有的li的使用的spot
+            Array.from(this.styleList.listDom.children()).forEach((li,index)=>{//更新一下所有的li的使用的spot
+                if(index == 0)return //第一个是upload
                 li.sameContentSpots = this.findSpotByContent(li._styleImg, 'shine')
             })
         
@@ -2272,6 +2298,7 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
             $li.bind('mouseover', (e)=>{
                 /* this.showTitileSpots = $li[0].sameContentSpots; 
                 this.showTitileSpots.forEach(a=>a.showTitle())  */
+                if($li.index() == 0)return
                 countElem.text("热点个数:"+$li[0].sameContentSpots.length).removeClass('hide')
                 $li.append(countElem)  
                 $li[0].sameContentSpots.forEach(hot=>{
@@ -3930,6 +3957,11 @@ Hotpoint.prototype.getSavingInfo = function(){//保存全部
         var sid = $(li).attr("data-spid");
         var hot = player.model.hots[sid]    
         var hotData = CloneObject(hot.info) 
+        
+        for(let i in hotData){
+            if(hotData[i] == void 0 )delete hotData[i]
+        }
+        
         if(hotData.texSrc){
             hotData.texSrc = manage.removeSrcPostMark(hotData.texSrc)
         }

+ 1 - 1
js/main_2020_edit.js

@@ -22122,7 +22122,7 @@ function o(a, s, l) {
                 this.flying = true
                 this.nextPano = pano //提前加载高清图片
                 this.path.warpDestHeroLoc = {  
-                    panoId : o.panoId,
+                    panoId : pano.id,
                     position: pano.position,
                     quaternion: o.quaternion || this.quaternion.clone()
                    

+ 13 - 10
js/main_2020_show.js

@@ -20483,23 +20483,23 @@ window.Modernizr = function(n, e, t) {
             ,
             n.prototype.createCpm = function(e) {
                 if (!this.currentPanoMarker) {
-                    /* var t = this.makeWaypointObj(w.pathEnd, "Current");
-                    t.material.uniforms.opacity.value = 0, */
+                    var t = this.makeWaypointObj(w.pathEnd, "Current");
+                    t.material.uniforms.opacity.value = 0, 
                     
-                     
-                    let sprite = new THREE.Mesh(new THREE.PlaneBufferGeometry(0.4,0.4,1,1), new THREE.MeshBasicMaterial({
+                    //变成一个定位sprite 
+                    /* let sprite = new THREE.Mesh(new THREE.PlaneBufferGeometry(0.4,0.4,1,1), new THREE.MeshBasicMaterial({
                         map: v.load('images/icon_address.png'), depthTest:false,
                         transparent:true,
                     }))
                     sprite.position.y = 0.3
                     let t = new THREE.Object3D()
-                    t.add(sprite)
+                    t.add(sprite) 
                     
                     setTimeout(()=>{
                          window.player.on("view.changed",()=>{
                              player.path.currentPanoMarker.mesh.quaternion.copy(player.quaternion)
                          }) 
-                    },1000)
+                    },1000)*/
                     
                     this.currentPanoMarker = {
                         mesh: t,
@@ -20524,13 +20524,16 @@ window.Modernizr = function(n, e, t) {
             }
             ,
             n.prototype.fadeInCpm = function(e) {
-                this.player.mode === a.PANORAMA && this.player.currentPano && !this.player.currentPano.isAligned() || c.path.mapGuides && this.currentPanoMarker.placed && p.start(u.property(this.currentPanoMarker.mesh.children[0].material/* .uniforms.opacity */, "opacity", 1), e)
+                //this.player.mode === a.PANORAMA && this.player.currentPano && !this.player.currentPano.isAligned() || c.path.mapGuides && this.currentPanoMarker.placed && p.start(u.property(this.currentPanoMarker.mesh.children[0].material/* .uniforms.opacity */, "opacity", 1), e)
+                this.player.mode === a.PANORAMA && this.player.currentPano && !this.player.currentPano.isAligned() || c.path.mapGuides && this.currentPanoMarker.placed && p.start(u.property(this.currentPanoMarker.mesh.material.uniforms.opacity, "value", 1), e)
             }
             ,
             n.prototype.fadeOutCpm = function(e) {
-                p.start(u.property(this.currentPanoMarker.mesh.children[0].material/* .uniforms.opacity */, "opacity", 0), e)
+                //p.start(u.property(this.currentPanoMarker.mesh.children[0].material/* .uniforms.opacity */, "opacity", 0), e)
+                p.start(u.property(this.currentPanoMarker.mesh.material.uniforms.opacity, "value", 0), e)
             }
-            ,
+            
+           
             n.prototype.popInCpm = function() {
                 c.path.mapGuides && this.currentPanoMarker.placed && this.fadeInCpm(2)
             }
@@ -22127,7 +22130,7 @@ window.Modernizr = function(n, e, t) {
                 this.updateModel()
                 
                 
-                this.guider2 = new PanTransGuide(this)
+                //this.guider2 = new PanTransGuide(this)
                 
                 
             }

+ 1 - 1
js/manage.js

@@ -46,7 +46,7 @@ var g_bgAudio=null;//背景音乐
 var g_tourAudio=null;//导览音乐
 var g_play = 1;//表示播放图标状态
 var g_playAudio = null;//当前在播放或当继续播放时应该播放的,是g_bgAudio或g_tourAudio 
-var g_currentHot = null;//当前打开的热点 
+ 
 //var g_Texture=null;
 //var g_ChunknameTexture={};   //chunkname和贴图名称对应
 var g_NormalTexture=false;