Quellcode durchsuchen

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/bigSceneEdit_java

tremble vor 3 Jahren
Ursprung
Commit
d32ecef990
5 geänderte Dateien mit 197 neuen und 78 gelöschten Zeilen
  1. 11 5
      edit.html
  2. 16 11
      js/Hot.js
  3. 34 9
      js/edit.js
  4. 8 4
      js/main_2020_edit.js
  5. 128 49
      js/main_2020_show.js

+ 11 - 5
edit.html

@@ -936,12 +936,18 @@
                             </ul>
                             
                             <div class="itemTitle">
-                                <span>热点默认大小 (初始值为1)</span>
+                                <span>调整大小(闪烁类型)</span>
                             </div>
-                            <ul id="hotIconScale" class="clearfix hotStyle-item colorWrap">
-                                <input class="" type="number" placeholder="请输入热点大小比例" value="1" max="100" min="0.1"
-                                    step="0.1">
-                            </ul>
+                              
+                            <!-- <input class="" type="number" placeholder="请输入热点大小比例" value="1" max="100" min="0.1"
+                                step="0.1"> -->
+                            <div name='adjustSize' class="buttons " style="font-size: 20px;">
+                                <button class="innerBtn cancel" index='-'>-</button>
+                                <button class="innerBtn cancel" index='+'>+</button>
+                            </div>    
+                                    
+                                    
+                            
                             
                             <ul class="switch clearfix   ">
                                 <label><input  id="autoAdjustHotScale" class="mui-switch mui-switch-animbg" type="checkbox">

+ 16 - 11
js/Hot.js

@@ -28,7 +28,11 @@ window.initHot = function(model){
         opacity: 0.8,
         side:THREE.DoubleSide
     })
-    var autoSizeInfo = {minSize : 120,  maxSize : 600,   nearBound : 1 , farBound :  15}
+     
+    var autoSizeInfo = /* {width2d:50}// */{minSize : 120,  maxSize : 600,   nearBound : 1 , farBound :  15}
+
+
+
 
     var hotGroup = new THREE.Object3D;  hotGroup.name = "hotGroup"
     model.add(hotGroup);   model.hotGroup = hotGroup
@@ -130,7 +134,7 @@ window.initHot = function(model){
              
             
             this.sid = info.sid;
-            this.preDeal(info, source)// source:来源
+            this.preDeal(info, source)// source:旧版来源
             
             this.info = info
             this.cornerPoints = []
@@ -532,7 +536,7 @@ window.initHot = function(model){
                     info.rotation = new THREE.Euler().setFromVector3(convertValue(info.rotation, THREE.Vector3 ))  //热点的旧数据很多是字符串 
                 }
                  
-                var s = Hot.getDefaulScale(info.hotIconScale)
+                var s = Hot.getDefaulScale(info.hotIconScale) //旧版的大小,统一转换成新版
                 info.scale = new THREE.Vector3(s,s,0.02)    
                
               
@@ -1410,11 +1414,10 @@ window.initHot = function(model){
             var plane = this.plane;
              
             if(type == 'photo'){
-                if(this.photoHasRequestLoad || this.texType != 'photo'){
-                    callback && callback()
-                    return;
+                if(this.photoHasRequestLoad || this.texType != 'photo'){ 
+                    return; //为什么之前1191需要在这加callback() 才能呢。现在又没事了
                 }
-                //console.log('overlay beginDownload : ' + this.sid)
+                console.log(' beginDownload : ' + this.sid)
                 
                  
                 /* this.material_.map =  */Texture.load(this.info.texSrc, (tex)=>{ 
@@ -1422,7 +1425,9 @@ window.initHot = function(model){
                     if(!tex.image ){
                         return  //只是单纯用了相同src的tex,但image仍未加载完
                     }
-                    //if(!this._loadDones)return
+                    if(!this._loadDones){
+                        return  
+                    }
                     dealMap(tex)
                     
                     setTimeout(Hot.loadNext, 50) 
@@ -1483,7 +1488,7 @@ window.initHot = function(model){
                             {
                                 e._loadDones.forEach(a=>a())
                                 e._loadDones = null
-                                e.photoHasRequestLoad = true
+                                //e.photoHasRequestLoad = true  //这句不能加,否则会无法执行callback
                             }
                             e.material_.needsUpdate = true
                             
@@ -1556,10 +1561,10 @@ window.initHot = function(model){
         let count = Hot.maxLoadingCount - loadings.length
         Hot.loadQueue.slice(0, count).forEach(e=>{
             loadings.push(e) 
-            //console.log('requestDownload', e.hot.info.texSrc)
+            console.log('requestDownload', e.hot.info.texSrc)
             e.hot.requestDownload(e.type, ()=>{
                 var i = loadings.indexOf(e)
-                //console.log('requestDownload index', i)
+                console.log('requestDownloaded index', i)
                 i > -1 && loadings.splice(i,1)
             })
         })

+ 34 - 9
js/edit.js

@@ -345,7 +345,7 @@ EditTools.prototype.initSaveAll = function() {
                 
                 showHotListSta: $('#hotListSwitch').is(':checked'),
                 // 开启热点列表
-                hotIconScale: DATA.hotIconScale,
+                //hotIconScale: DATA.hotIconScale,
                 // 热点缩放
                 supportsVR: $('#VRSwitch input').is(':checked'),
                 // 开启VR功能
@@ -653,8 +653,7 @@ SceneInformation.prototype.init = function(data, data2) {
     let momentTour = $('#tourSwitch input');
     // 导览瞬间过渡开关
     let hotListSwitch = $('#hotListSwitch');
-    // 热点列表开关
-    let hotIconScale = $('#hotIconScale');
+     
     // 热点图标缩放
     let VRSwitch = $('#VRSwitch input');
     // VR功能开启
@@ -715,9 +714,9 @@ SceneInformation.prototype.init = function(data, data2) {
         $('#newBlack').prop('checked', true);
     }
     
-    if (data.hotIconScale) {
-        hotIconScale.val(parseFloat(data.hotIconScale));
-    }
+    /* if (data.hotIconScale) {
+        $('#hotIconScale input').val(parseFloat(data.hotIconScale));
+    } */
     
     /* $('#hotIconScale_2 input').on('change',(e)=>{
         var s = THREE.Math.clamp(parseFloat(e.target.value), 0.1, 100)
@@ -1037,7 +1036,7 @@ Hotpoint.prototype.init = function() {
         })
     }
     
-    {
+    /* {
         let ui = $('#hotIconScale input')
         let min = parseFloat(ui.attr('min'));
         let max = parseFloat(ui.attr('max'));
@@ -1048,7 +1047,33 @@ Hotpoint.prototype.init = function() {
             DATA.hotIconScale = s
         })
         
-    }
+    } */
+    
+    
+    $(".hotpoint [name='adjustSize'] button").on('click',(e)=>{
+        let type = $(e.target).attr('index')
+        var c = 1.1 
+        if(type == '-'){
+            s = 1/c
+        }else{
+            s = c
+        }
+        player.model.hotGroup.children.forEach(hot=>{
+            if(hot.texType == 'shine'){
+                hot.info.scale.multiplyScalar(s)
+                hot.scale.multiplyScalar(s)
+            }
+        })
+        
+        
+    })
+    
+    
+    
+    
+    
+    
+    
     
     this.isSpriteCheckBox = new CheckBox({dom:  $("#isSprite"),
         uiCallBack : (checked)=>{ 
@@ -2852,7 +2877,7 @@ Hotpoint.prototype.useSuitableRatio = function(o={}) {//自适应素材比例
         if(hot.texType == 'shine'){//默认使用热点大小,正方形
              
             if(o.setScaleAuto){
-                w = h = DATA.hotIconScale * g_HotMeshSize.g_HotMeshWidth  
+                w = h = 1 //DATA.hotIconScale * g_HotMeshSize.g_HotMeshWidth  
             }else{
                 s = hot.scale.x * hot.scale.y
                 w = h = Math.sqrt(Math.abs(s))

+ 8 - 4
js/main_2020_edit.js

@@ -21406,11 +21406,13 @@ function o(a, s, l) {
                             this.intersectHot && CursorDeal.add('hoverHot' )  //$("#player").css("cursor", "pointer");
                          
                         }
-                    }  
+                    }else{
+                        this.intersect = this.getMouseIntersect()  
+                    } 
                 }
                 
                 
-                this.intersect = this.getMouseIntersect(),
+                
                 this.intersect && this.updateClosestPano(this.intersect),
                 this.closestPano || this.closestPanoInDirection(this.getMouseDirection()) ? (this.reticule.updatePosition(this.position, this.intersect),
                 k.navigation.panoScores && !k.navigation.mouseDirection && this.closestPanoInDirection(this.getDirection())) : this.reticule.hide()
@@ -21499,14 +21501,16 @@ function o(a, s, l) {
                 var t = t1 || this.model.floors.reduce(function(e, t) {
                         return t.hidden ? e : e.concat(t.collider.children)
                     }, this.mode === V.PANORAMA ? this.panoMarkers : []),
-                t = t.slice(0) 
+                t = t.slice(0)  
+                 
+                
                 i = new B.Vector3(e.x,e.y,-1).unproject(this.camera);
                 this.raycaster.set(i, this.getMouseDirection(e));
                 var n = this.raycaster.intersectObjects(t , true );//add true
                    
                 var o = n[0]; 
                 
-                if(o){
+                if(o){ 
                     o.face && (o.normal = o.face.normal.applyQuaternion(o.object.quaternion),
                     this.position.clone().sub(o.point).dot(o.normal) < 0 && o.normal.negate(),
                     this.currentPano ? o.onFloor = o.point.y < this.position.y - .5 * this.currentPano.height : o.onFloor = o.point.y < this.position.y - .5,

+ 128 - 49
js/main_2020_show.js

@@ -3085,7 +3085,7 @@ window.Modernizr = function(n, e, t) {
             insideNear: .1,
             insideFar: 5e3,
             insideLookSpeed: .12,
-            insideLookLimitUp: 40,
+            insideLookLimitUp: 40,  //视角
             insideLookLimitDown: -40,
             orthoNear: 1,
             orthoFar: 5e3,
@@ -4534,22 +4534,22 @@ window.Modernizr = function(n, e, t) {
                 this.updateModel(),
                 this.resetAll(),
                 this.bindEvents()
-                // zeg 查询pano对应的导览片段
-                if(!this.panoIdMap) {
-                    this.panoIdMap = new Map()
-                    this.model.heroLocations.forEach( (value, index) => {
-                        // value.heroLocations.forEach( hl => {
-                            if(!value.heroLocations) return
-                            let hl = value.heroLocations[0]
-                            let arr = this.panoIdMap.get(hl.panoId)
-                            if(arr){
-                                this.panoIdMap.set(hl.panoId, [...arr, index])
-                            } else {
-                                this.panoIdMap.set(hl.panoId, [index])
-                            }
-                        // })
-                    })
-                }
+                // // zeg 查询pano对应的导览片段
+                // if(!this.panoIdMap) {
+                //     this.panoIdMap = new Map()
+                //     this.model.heroLocations.forEach( (value, index) => {
+                //         // value.heroLocations.forEach( hl => {
+                //             if(!value.heroLocations) return
+                //             let hl = value.heroLocations[0]
+                //             let arr = this.panoIdMap.get(hl.panoId)
+                //             if(arr){
+                //                 this.panoIdMap.set(hl.panoId, [...arr, index])
+                //             } else {
+                //                 this.panoIdMap.set(hl.panoId, [index])
+                //             }
+                //         // })
+                //     })
+                // }
             }
             ,
             n.prototype.resetAll = function() {
@@ -4908,33 +4908,83 @@ window.Modernizr = function(n, e, t) {
                     .bind(this), this.goNext.bind(this))
             }
             ,
-            n.prototype.playTour = function() {
-                if (!this.bounceable()) {
-
-                    if(!this.currentItem) this.currentItem = []
-                    if(this.currentItem[0] != 0 || this.destinationItem[0]!= this.nItems-1){
-                        // zeg 从当前pano进行自动导览
-                        let currentPanoDestinations = this.panoIdMap.get(this.player.currentPano.id)
-                        // this.model.heroLocations.forEach( (value, index) => {
-                            // if(value.heroLocations.find( hl => hl.panoId == this.player.currentPano.id )) {
-                            //     currentPanoDestinations.push(index)
-                            // }
-                        // })
-
-                        if(!currentPanoDestinations) { 
-                            // let panoIndex = this.model.panos.list.findIndex( pano => pano.id == this.player.currentPano.id )
-                            let panoIndex = this.model.panos.list.indexOf( this.player.currentPano )
-                            let neighbourIndex = [ panoIndex + 1, panoIndex - 1, panoIndex + 2, panoIndex - 2, panoIndex + 3, panoIndex - 3 ]
-                            for(var i = 0; i < neighbourIndex.length; i++) {
-                                currentPanoDestinations = this.panoIdMap.get(this.model.panos.list[neighbourIndex[i]]&&this.model.panos.list[neighbourIndex[i]].id)
-                                if(currentPanoDestinations && currentPanoDestinations[0] != 0) break
+            
+            
+            
+            
+            n.prototype.findNearestItem = function(){//找到离currentPano最近的导览
+                var result = {item:[0,0], dis:Infinity};
+                var compare = (location, item)=>{
+                    if(location.panoId != void 0 && location.panoId!= "outside"){
+                        var pano = this.model.panos.index[location.panoId];
+                        var dis = pano.position.distanceTo(this.player.currentPano.position)
+                        if(dis<result.dis){
+                            result.item = item, result.dis = dis
+                        }else if(dis == result.dis){//如果两个位置相同,优先播放在导览条上离激活的最近的那段导览 
+                            /* if(this.itemCompare(item,  this.currentItem, 'equal')){
+                                result.item = item, result.dis = dis
+                            } */ 
+                            if(this.currentItem && Math.abs(item[0]-this.currentItem[0]) < Math.abs(result.item[0]-this.currentItem[0])){
+                                result.item = item, result.dis = dis
                             }
-                            if(!currentPanoDestinations) currentPanoDestinations = [0];
-                        }
-                        if(currentPanoDestinations.indexOf(this.currentItem[0]) == -1) {
-                            this.currentItem[0] = currentPanoDestinations[0]
+                            
+                            
                         }
                     }
+                    
+                }
+                this.model.heroLocations.forEach((e,i)=>{
+                    if(e.heroLocations){
+                       /* e.heroLocations.forEach((a,j)=>{
+                           compare(a, [i,j])
+                       }) */
+                       var location = e.heroLocations.find(e=>e.panoId != void 0)
+                       location && compare(location, [i,0])
+                       
+                    }else{
+                       compare(e, [i,0])
+                    }  
+                    
+                })
+                return result.item
+                
+            }
+            
+            
+            
+            
+            
+            
+            
+            
+            n.prototype.playTour = function() {
+                if (!this.bounceable() && this.model.heroLocations.length) {
+
+                    // ------------这部分处理逻辑目前已由playTourNearBy()取代------------------------------------
+                    // if(!this.currentItem) this.currentItem = []
+                    // if(this.currentItem[0] != 0 || this.destinationItem[0]!= this.nItems-1){
+                    //     // zeg 从当前pano进行自动导览
+                    //     let currentPanoDestinations = this.panoIdMap.get(this.player.currentPano.id)
+                    //     // this.model.heroLocations.forEach( (value, index) => {
+                    //         // if(value.heroLocations.find( hl => hl.panoId == this.player.currentPano.id )) {
+                    //         //     currentPanoDestinations.push(index)
+                    //         // }
+                    //     // })
+
+                    //     if(!currentPanoDestinations) { 
+                    //         // let panoIndex = this.model.panos.list.findIndex( pano => pano.id == this.player.currentPano.id )
+                    //         let panoIndex = this.model.panos.list.indexOf( this.player.currentPano )
+                    //         let neighbourIndex = [ panoIndex + 1, panoIndex - 1, panoIndex + 2, panoIndex - 2, panoIndex + 3, panoIndex - 3 ]
+                    //         for(var i = 0; i < neighbourIndex.length; i++) {
+                    //             currentPanoDestinations = this.panoIdMap.get(this.model.panos.list[neighbourIndex[i]]&&this.model.panos.list[neighbourIndex[i]].id)
+                    //             if(currentPanoDestinations && currentPanoDestinations[0] != 0) break
+                    //         }
+                    //         if(!currentPanoDestinations) currentPanoDestinations = [0];
+                    //     }
+                    //     if(currentPanoDestinations.indexOf(this.currentItem[0]) == -1) {
+                    //         this.currentItem[0] = currentPanoDestinations[0]
+                    //     }
+                    // }
 
                     return this.tourIsPlaying ? void A.info("tour is already playing") : void (this.wouldInterrupt() || (this.player.emit("tour_auto", this.defaultWarpStyle),
                     this.tourInProgress = !0,
@@ -4946,11 +4996,39 @@ window.Modernizr = function(n, e, t) {
                     this.emit("update.controls"),
                     this.emit(p.TourStart),
                     this.player.enablePreRendering(),
-                    this.currentItem[1] = null,
+                    // this.currentItem[1] = null,
                     this.walkingSectionPaused ? (this.clearWalkingSectionPaused(),
                     this.goToDestination()) : this.goNext()))
                 }
             } 
+            
+            
+            
+            n.prototype.playTourNearBy = function() {
+                
+                if (!this.bounceable()){
+                    return this.tourIsPlaying ? void A.info("tour is already playing") : void (this.wouldInterrupt() || (this.player.emit("tour_auto", this.defaultWarpStyle),
+                    this.tourInProgress = !0,
+                    this.reachSource = "play",
+                    this.tourIsPlaying = !0,
+                    this.wasZoomEnabled = this.player.zoomEnabled,
+                    this.player.zoomEnabled = !1,
+                    this.resetSpecialTransition(),
+                    this.emit("update.controls"),
+                    this.emit(p.TourStart),
+                    this.player.enablePreRendering(),
+ 
+                    /* this.walkingSectionPaused ? (this.clearWalkingSectionPaused(),
+                    this.goToDestination()) : this.goNext())) */
+                    
+                    
+                    this.setDestinationItem(this.findNearestItem()) , this.goToDestination()) )
+               } 
+                
+                
+                
+            }
+            
 			,
 			/* n.prototype.bgmReplay = function() {//xzw add  结束tour后可能要继续播放背景音乐
 			  
@@ -5123,15 +5201,15 @@ window.Modernizr = function(n, e, t) {
                 
                 A.debug("tourAdvance(" + e + ")") 
 
-                // zeg改
+                // // zeg改
                 if(null === this.currentItem || void 0 === this.currentItem){
                     // this.setDestinationItem(this.firstDestination()) 
                     // this.setDestinationItem([currentPanoDestinations[0], 0]) 
                     this.setDestinationItem([this.currentItem[0], 0]) 
                 }
-                else if(this.currentItem[1] == null) {
-                    this.setDestinationItem([this.currentItem[0], 0])
-                }
+                // else if(this.currentItem[1] == null) {
+                //     this.setDestinationItem([this.currentItem[0], 0])
+                // }
                 else{ 
                     
                         var item    
@@ -5144,7 +5222,7 @@ window.Modernizr = function(n, e, t) {
                         this.setDestinationItem(item) 
                 }
                 
-                if(this.itemCompare(this.destinationItem, this.finalDestination(), 'equal')[0] < 0 ){ 
+                if(this.itemCompare(this.destinationItem, this.finalDestination(), 'equal')){ 
                     this.useSpecialTransition("reverse-looping to end") 
                 }else if(this.itemCompare(this.destinationItem, this.firstDestination(), 'equal')){ 
                     this.useSpecialTransition("looping back to start")
@@ -8946,7 +9024,8 @@ window.Modernizr = function(n, e, t) {
             })
         }
         function r() {
-            C.playTour(),
+            // C.playTour(),
+            C.playTourNearBy(),
             I && clearTimeout(I),
             d(),
             _.removeClass("fadeIn")
@@ -23765,7 +23844,7 @@ window.Modernizr = function(n, e, t) {
             ,
             n.prototype.getCurrentNodePanos = function(e) {
                 this.model.panos.map;
-                if (e.length = 0, this.path.nodes){
+                if (e.length = 0, this.path.nodes.length){
                     
                     var momentTour = this.director.getMomentTour(this.director.destinationItem)  
                     if(momentTour == 'black'){ //改 upcomingPanos如果是black的只需要起点和终点