xzw 2 rokov pred
rodič
commit
055527bf58
6 zmenil súbory, kde vykonal 186 pridanie a 96 odobranie
  1. 3 4
      css/main.css
  2. 2 2
      js/Hot.js
  3. 1 0
      js/edit.js
  4. 13 2
      js/main_2020_edit.js
  5. 120 75
      js/main_2020_show.js
  6. 47 13
      js/manage.js

+ 3 - 4
css/main.css

@@ -7270,11 +7270,10 @@ a.hasHover.tag-link:hover {
 }
 
 .widgets-doll-labels .room-label.selected a{
-    background: rgb(57 72 255 / 88%);
-    border: 2px solid rgb(0 255 231);
+    background: rgb(0 0 0 / 88%);
+    border: 2px solid rgb(255 255 255);
     border-radius: 3px;
-    text-shadow: 0px 1px 3px #04e79ecc;
-    
+    text-shadow: 0px 1px 3px #ffffff;  
 }    
 .widgets-doll-labels.noLine .room-label a{
     top: 0; 

+ 2 - 2
js/Hot.js

@@ -752,7 +752,7 @@ window.initHot = function(model){
             }
             
             this.visible = visibility != void 0 ? visibility : (!this.info.visiblePanos || !!panos.find(pano=>this.info.visiblePanos.includes(pano.id)))
-            this.titleElem && this.titleElem.setVisible(this.visible, 'hotVisible')
+            this.titleElem && this.titleElem.setVisible(this.visible, 'hotVisible', 1)
             
             if (this.texType == 'video'){
                 //this.switchPlay(this.visible,  this.visible ? null : 'stop' );//可见时不操作;不可见时停止
@@ -1098,7 +1098,7 @@ window.initHot = function(model){
             this.hovered = !!state
             
             var v = this.info.titleShowType != 'unvisible' && (this.info.titleShowType == 'always' || this.hovered)
-            this.titleElem.setVisible(v, 'hoveredVisi')
+            this.titleElem.setVisible(v, 'hoveredVisi', 1)
             //this.updateTitle()  
         }
         

+ 1 - 0
js/edit.js

@@ -524,6 +524,7 @@ class EditLabel{
             label.setEditSelect(true)
             pannel.insertAfter(label.$li)     
             this.editingLabel = label 
+            player.focusPoint({aim: label.position, radius: label.position.distanceTo(player.position)}) 
         }else{
             label.elem.removeClass('selected')
             pannel.addClass('hide')

+ 13 - 2
js/main_2020_edit.js

@@ -21458,7 +21458,18 @@ function o(a, s, l) {
                         if(this.intersect){
                             deal()
                             this.intersectHot && CursorDeal.add('hoverHot' )  //$("#player").css("cursor", "pointer");
-                         
+                            if(this.intersect){
+                                deal()
+                                let intersect = this.intersect
+                                if(this.intersectHot){
+                                    this.intersect = null
+                                    $("#player").css("cursor", "pointer");
+                                }else{  
+                                    if(intersect.object.parent.parent.hidden ){//楼层已隐藏
+                                        this.intersect = null
+                                    } 
+                                } 
+                            }
                         }
                     }else{
                         this.intersect = this.getMouseIntersect()  
@@ -21968,7 +21979,7 @@ function o(a, s, l) {
             
             window._tranOutsideFocus = 4399 
             t.prototype.focusPoint = function(o={}){//当在外时,聚焦相机到这一点 
-                console.log("focusPoint")
+                //console.log("focusPoint")
                 if(this.mode == "floorplan"){
                     var modelSize = o.modelSize || new THREE.Vector3(8,8,8);//可视范围
                     var control = player.cameraControls.controls.floorplan;

+ 120 - 75
js/main_2020_show.js

@@ -19630,7 +19630,7 @@ window.Modernizr = function(n, e, t) {
                         }
                         this.tileDownloader.clearForceQueue(),
                         this.tileDownloader.forceQueueTilesForPano(this, i, n, h, u, s),
-                        this.tiledPanoRenderTarget = this.panoRenderer.activateTiledPano(this, this.qualityManager.getMaxNavPanoSize(), o),
+                        this.tiledPanoRenderTarget = this.panoRenderer.activateTiledPano(this, Math.min(2048, this.qualityManager.getMaxNavPanoSize()) , o), //不要超过2048否则漫游到下一个点时卡顿
                         this.panoRenderer.renderPanoTiles(this.id, n, a)
                     }
                     return c.promise()
@@ -19690,7 +19690,7 @@ window.Modernizr = function(n, e, t) {
                 }
                 if(this.minimumTiledPanoLoaded)
                 {
-                    if(this.zoomed && this.qualityManager.maxRenderTargetSize > this.qualityManager.maxNavPanoSize)//change 如果放大后和不放大都是2k就不用这个
+                    if(this.zoomed && (this.qualityManager.maxRenderTargetSize > this.qualityManager.maxNavPanoSize|| player.qualityManager.getNavZoomClass() == '4k'  ))//change 如果放大后和不放大都是2k就不用这个
                     {
                         return this.panoRenderer.zoomRenderTarget.texture;   
                     }
@@ -23034,14 +23034,23 @@ window.Modernizr = function(n, e, t) {
                     this.intersect = this.getMouseIntersect(null, hots.concat(this.model.colliders));
                     if(this.intersect){
                         deal()
-                        this.intersectHot && $("#player").css("cursor", "pointer");
-                         
-                    }
-                }   
+                        let intersect = this.intersect
+                        if(this.intersectHot){
+                            this.intersect = null
+                            $("#player").css("cursor", "pointer");
+                        }else{  
+                            if(intersect.object.parent.parent.hidden ){//楼层已隐藏
+                                this.intersect = null
+                            } 
+                        } 
+                    } 
+                    
+                }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),
                 f.navigation.panoScores && !f.navigation.mouseDirection && this.closestPanoInDirection(this.getDirection())) : this.reticule.hide() 
@@ -23466,10 +23475,10 @@ window.Modernizr = function(n, e, t) {
                     }
                     
                     
-                    if(!this.model.supportsTiles && i.getSkyboxTexture().image[0].width > 1024){
+                    if(!this.model.supportsTiles && i.getSkyboxTexture().image[0].width > 1024 /* || this.qualityManager.getMaxZoomClass() == '4k' */){
                         setTimeout(()=>{
                             beginTran()
-                        },16) //2048的非tile需要延迟到下一帧,因为需要时间载入贴图,否则掉帧
+                        },  50) //2048的非tile需要延迟到下一帧,因为需要时间载入贴图,否则掉帧
                     }else{
                         beginTran()
                     }
@@ -24526,74 +24535,91 @@ window.Modernizr = function(n, e, t) {
                 if (!this.panoRenderer.zoomPanoRenderingDisabled && this.mode === u.PANORAMA && this.currentPano) {
                     let navTileClass = this.qualityManager.getNavZoomClass() 
                     let tileClass = this.qualityManager.getMaxZoomClass()
-                    let levelThreshold1 = navTileClass == '1k' ? 1.1 : 1.5 , levelThreshold2 = 1.8 //levelThreshold2不能比zoom.max大也就是不能超过2,否则zoom.max将无法提升到3
-               
-                    var t = this.zoomLevel > levelThreshold1
-                        , i = this.flying && this.nextPano && this.nextPano !== this.currentPano
-                        , n = !i && !this.isWarping()
-                        , r = t //&& n ;  // 允许flying状态下加载4K图
-                        this.tileDownloader.tilePrioritizer.setZoomingActive(r),
-                        this.panoRenderer.setZoomingActive(r, this.currentPano, !0);
-                        var o = function(pano, ifZoom) {
-                            this.panoRenderer.resetRenderStatus(pano.id, !1, !0, this.qualityManager.getMaxNavPanoSize()),
-                            this.panoRenderer.clearAllQueuedUploadsForPano(pano.id),
-                            this.panoRenderer.renderPanoTiles(pano.id, null, !1, !1),
-                            pano.setZoomed(ifZoom)
-                        }.bind(this);
+                     
+                    if(navTileClass == '4k'){ 
+                        var r = true 
+                    }else{ 
+                        var levelThreshold1 = navTileClass == '1k' ? 1.1 : 1.5 , levelThreshold2 = 1.8 //levelThreshold2不能比zoom.max大也就是不能超过2,否则zoom.max将无法提升到3
+                        var t = this.zoomLevel > levelThreshold1
+                            , i = this.flying && this.nextPano && this.nextPano !== this.currentPano
+                            , n = !i && !this.isWarping()
+                            , r = t //&& n ;  // 允许flying状态下加载4K图
+                    }
                     
-                    let zoomLevelRes = this.qualityManager.zoomLevelResolution
+                     
+                    this.tileDownloader.tilePrioritizer.setZoomingActive(r),
+                    this.panoRenderer.setZoomingActive(r, this.currentPano, !0);
+                    var o = function(pano, ifZoom) {
+                        this.panoRenderer.resetRenderStatus(pano.id, !1, !0, this.qualityManager.getMaxNavPanoSize()),
+                        this.panoRenderer.clearAllQueuedUploadsForPano(pano.id),
+                        this.panoRenderer.renderPanoTiles(pano.id, null, !1, !1),
+                        pano.setZoomed(ifZoom)
+                    }.bind(this);
                     
-                    if (r && (!this.currentPano.zoomed || zoomLevelRes && zoomLevelRes != '4k')) {//needZoom
-                        this.currentPano.zoomed || o(this.currentPano, !0); 
-                        
-                        if(navTileClass == '1k' && tileClass != '1k' && this.zoomLevel < levelThreshold2){
-                            this.panoRenderer.enableHighQuality( function() {//开启2k 
-                                if(tileClass != '4k'){
-                                    o(this.currentPano, !0); 
-                                }
-                            }.bind(this));
-                        }else{ 
+                    
+                    if(navTileClass == '4k'){ 
+                        if (!this.currentPano.zoomed) {
+                            o(this.currentPano, !0); 
                             this.panoRenderer.enableUltraHighQualityMode(function() {//开启4k getMaxZoomPanoSize
-                                this.qualityManager.useUltraHighResolutionPanos && !f.zoom.overridemax && (f.zoom.max = D.ultraHighQualityMaxZoom) 
+                                this.qualityManager.useUltraHighResolutionPanos  && (f.zoom.max = D.ultraHighQualityMaxZoom);
                                 o(this.currentPano, !0)
-                            }.bind(this));
-                        } 
-                    } else {  
-                        !t && this.currentPano.zoomed && o(this.currentPano, !1);
-                    }
-                    
-                    
-                    //有三个级别的话,需要标记zoomLevelResolution,以便更新maxZoomPanoSize判断能下载的最高级别
-                    if(r && navTileClass == '1k' && tileClass == '4k'  ){ //目前只有手机端navTileClass == '1k'
-                        var change = (zoomedFlag)=>{ 
-                            this.qualityManager.updateMaximums()//更新maxZoomPanoSize
-                            this.panoRenderer.setupZoomRenderTarget() //更新renderTarget  
-                            //this.currentPano.setZoomed(t);//更新uniforms贴图 
+                            }
+                            .bind(this)); 
+                        }
+                    }else{
+                        let zoomLevelRes = this.qualityManager.zoomLevelResolution
+                        
+                        if (r && (!this.currentPano.zoomed || zoomLevelRes && zoomLevelRes != '4k')) {//needZoom
+                            this.currentPano.zoomed || o(this.currentPano, !0); 
                             
-                            if(this.qualityManager.zoomLevelResolution == '4k'){
-                                this.model.showHighMap()
-                            }else{
-                                this.model.hideHighMap()
-                            }                                
+                            if(navTileClass == '1k' && tileClass != '1k' && this.zoomLevel < levelThreshold2){
+                                this.panoRenderer.enableHighQuality( function() {//开启2k 
+                                    if(tileClass != '4k'){
+                                        o(this.currentPano, !0); 
+                                    }
+                                }.bind(this));
+                            }else{ 
+                                this.panoRenderer.enableUltraHighQualityMode(function() {//开启4k getMaxZoomPanoSize
+                                    this.qualityManager.useUltraHighResolutionPanos && !f.zoom.overridemax && (f.zoom.max = D.ultraHighQualityMaxZoom) 
+                                    o(this.currentPano, !0)
+                                }.bind(this));
+                            } 
+                        } else {  
+                            !t && this.currentPano.zoomed && o(this.currentPano, !1);
                         }
-                        this.qualityManager.zoomLevelResolution = this.zoomLevel >= levelThreshold2 ? '4k' : this.zoomLevel > levelThreshold1? '2k' : '1k'
                         
-                        if(this.oldZoomLevel < levelThreshold2 && this.zoomLevel >= levelThreshold2){//1k/2k-4k
-                            change()
-                            o(this.currentPano, t)
-                        }else if(this.oldZoomLevel <= levelThreshold1 && this.zoomLevel > levelThreshold1){//1k-2k
-                            change()
-                        }else if(this.oldZoomLevel > levelThreshold2 && this.zoomLevel <= levelThreshold2){//4k-2k/1k
-                            change()
-                            o(this.currentPano, t)
-                        }else if(this.oldZoomLevel > levelThreshold1 && this.zoomLevel <= levelThreshold1){//2k-1k
-                            change() 
-                        } 
-                        this.oldZoomLevel = this.zoomLevel  
-                    }    
+                        
+                        //有三个级别的话,需要标记zoomLevelResolution,以便更新maxZoomPanoSize判断能下载的最高级别
+                        if(r && navTileClass == '1k' && tileClass == '4k'  ){ //目前只有手机端navTileClass == '1k'
+                            var change = (zoomedFlag)=>{ 
+                                this.qualityManager.updateMaximums()//更新maxZoomPanoSize
+                                this.panoRenderer.setupZoomRenderTarget() //更新renderTarget  
+                                //this.currentPano.setZoomed(t);//更新uniforms贴图 
+                                
+                                if(this.qualityManager.zoomLevelResolution == '4k'){
+                                    this.model.showHighMap()
+                                }else{
+                                    this.model.hideHighMap()
+                                }                                
+                            }
+                            this.qualityManager.zoomLevelResolution = this.zoomLevel >= levelThreshold2 ? '4k' : this.zoomLevel > levelThreshold1? '2k' : '1k'
                             
+                            if(this.oldZoomLevel < levelThreshold2 && this.zoomLevel >= levelThreshold2){//1k/2k-4k
+                                change()
+                                o(this.currentPano, t)
+                            }else if(this.oldZoomLevel <= levelThreshold1 && this.zoomLevel > levelThreshold1){//1k-2k
+                                change()
+                            }else if(this.oldZoomLevel > levelThreshold2 && this.zoomLevel <= levelThreshold2){//4k-2k/1k
+                                change()
+                                o(this.currentPano, t)
+                            }else if(this.oldZoomLevel > levelThreshold1 && this.zoomLevel <= levelThreshold1){//2k-1k
+                                change() 
+                            } 
+                            this.oldZoomLevel = this.zoomLevel  
+                        }    
+                                
+                    }
                 }
-                
             }
             
             n.prototype.checkHasNeighbor = function(pano){//add
@@ -28100,7 +28126,7 @@ window.Modernizr = function(n, e, t) {
                     if(targets[size]){
                         this.zoomRenderTarget = targets[size]
                     }else{
-                        this.zoomRenderTarget = this.initTiledPano(size, false  )//放大后不使用抗锯齿,否则消耗更多内存
+                        this.zoomRenderTarget = this.initTiledPano(size, true  )//放大后不使用抗锯齿,否则消耗更多内存
                         targets[size] = this.zoomRenderTarget
                     }
             
@@ -28856,7 +28882,7 @@ window.Modernizr = function(n, e, t) {
                 case '2k':             
                 default:
                     return r.HIGH;
-                case '4k': //虽然这种暂不支持
+                case '4k': 
                     return r.ULTRAHIGH;
             }
         }
@@ -29362,8 +29388,15 @@ window.Modernizr = function(n, e, t) {
                 this.priorityCriteria.cameraPosition.copy(t),
                 this.priorityCriteria.cameraDir.copy(i),
                 this.priorityCriteria.upcomingPanos = n,
-                this.maxNavQuality = this.qualityManager.getMaxNavPanoSize(),
+                
+                this.maxNavQuality = this.qualityManager.getMaxNavPanoSize()
                 this.maxZoomQuality = this.qualityManager.getMaxZoomPanoSize()
+                 
+                if(!player.panoRenderer.isPanoZoomed(e.id)){ //xzw add,直到到达该点后才能下载4k,否则不会渲染到zoomRenderTarget上
+                    this.maxNavQuality = Math.min(2048, this.maxNavQuality)
+                    this.maxZoomQuality = Math.min(2048, this.maxZoomQuality)
+                }
+                
             }
             ,
             n.prototype.filterAndPrioritize = function() {
@@ -31400,15 +31433,24 @@ window.Modernizr = function(n, e, t) {
                 if(urlFirstView){
                     try{  
                         urlFirstView = replaceAll(urlFirstView, "pano:", '"pano":"')  
-                        urlFirstView = replaceAll(urlFirstView, ",qua:", '","qua":[') 
-                        urlFirstView = "{"+urlFirstView+"]}"
+                        urlFirstView+='"'
+                        if(urlFirstView.includes('qua')){
+                            urlFirstView = replaceAll(urlFirstView, ",qua:", ',"qua":[') 
+                            urlFirstView += ']'
+                        }
+                        
+                        urlFirstView = "{"+urlFirstView+"}"
                         let info = JSON.parse(urlFirstView);   
                         i.pano = t.index[info.pano] //panos.get(info.pano)
                         if(!i.pano){
                             urlFirstView = false
                             console.error('检测到firstView但是 找不到该pano')
                         }else{
-                            i.quaternion = new THREE.Quaternion().fromArray(info.qua)
+                            if(info.qua){
+                                i.quaternion = new THREE.Quaternion().fromArray(info.qua)
+                            }else{
+                                i.quaternion = new THREE.Quaternion()
+                            }
                             i.zoom = -1;
                             i.mode = "panorama"
                             i.setByUrl = true
@@ -60418,6 +60460,9 @@ var addMagnifier = function(){
     展示版导览改为就近导览,所以一开始并非第一个。如果在最后一个点上会自动从头开始
     
     
-    
+    关于pc-nav 4k
+    两种选择,1 按照正常流程,因为nav为4k所以直接使用4k的tiledPanoRenderTarget, 但useUltraHighResolutionPanos需要开启才能达到4k,否则是2k。这样的话第一个点位需要手动重新替换tiledPanoRenderTarget,所以废弃
+    2 使zoomed一直为true,直接使用zoomRenderTarget。  参考之前写过的三屏的本地4k。 且创建的tiledPanoRenderTarget不能超过2048否则过渡卡顿;且直到到达该点后才能下载4k,否则不会渲染到zoomRenderTarget上 
+ 
  */
  

+ 47 - 13
js/manage.js

@@ -1443,25 +1443,50 @@ function initByTHREE(THREE){
         
         
         update(currentFloor){
-            if(!this.position || !this.visible)return
+            if(!this.position)return
+            
+            if(!this.visible && this.unvisibleReasons.some(e=>e.level == 1) && !this.unvisibleReasons.some(e=>e.level>1) )return;
+            /* 
+                规定一下level共四层
+                level3 是notTrueSide层,权重最高。
+                level2 是强制可见层,如editSelected
+                level1 是强制不可见,如isPanorama 
+                level0 是shelter层
+                
+                其中当visible==false时, 若导致不可见的原因是level1 代表不需要计算直接return, 否则还是要执行update 以计算更新可见性
+                所以外部写的setVisible的level必须>0
+            */
+             
+           
+             
              
             var p = convertTool.getPos2d(this.position);
             if(!p || !p.trueSide){
-                this.elem.css('display','none');  return;
+                return this.setVisible(false, 'notTrueSide', 3, null, true)
+                //this.elem.css('display','none');  return;
             }
-            
+            this.setVisible(true, 'notTrueSide', 3, null, true)
+             
+            this.setVisible(true, 'shelter', 0, null, true) 
             //判断label是否被模型遮挡,遮挡则消失(如果是漫游模式最好提前计算visiblePanos)
             if(player.mode != 'panorama'){
                 currentFloor = currentFloor || player.model.currentFloor 
                 if(!player.model.allFloorsVisible && this.floorIndex != void 0 && this.floorIndex!= currentFloor.floorIndex){
-                    this.elem.css('display','none');	return;
+                    
+                    this.setVisible(false, 'shelter', 0, null, true)
+                    //this.elem.css('display','none');	return;
+                    if(!this.visible)return
                 }
                     
                 if(this.shelterByModel && convertTool.ifShelter(this.position , p.vector, player.camera, this.floorIndex )){
-                    this.elem.css('display','none');	return; 
+                    //this.elem.css('display','none');	return; 
+                    this.setVisible(false, 'shelter', 0, null, true)
+                    if(!this.visible)return
                 }
             }
             
+            
+            
             this.elem.css({
                 left: p.pos.x +'px',
                 top: p.pos.y +'px'
@@ -1473,21 +1498,30 @@ function initByTHREE(THREE){
                 this.elem.css({transform:''})
             } */
             
-            this.elem.css('display','block');
+            //this.elem.css('display','block');
             this.pos2d = p.vector;
             
              
             
         }
         
-        setVisible(visi, reason, level=0, type){
+        setVisible(visi, reason, level=1, type, updating){
+            let visiOld = this.visible
             convertTool.updateVisible(this, reason, visi, level, type  ) 
              
-            if(!this.visible){
+            updating || this.update() //再次更新可见性并计算位置
+            this.elem.css('display',this.visible?'block':'none');
+            
+            
+            
+            /* if(!this.visible){
                 this.elem.css('display','none');
             }else{ 
-                this.update()
-            }
+                if(!visiOld){
+                    updating || this.update()
+                    this.elem.css('display','block');
+                }
+            } */
         } 
         
          
@@ -1549,10 +1583,10 @@ function initByTHREE(THREE){
         setStyle(oldMode, mode, duration){
             if(!mode) mode = player.modeTran.split('-')[1] || player.mode //要变成的mode或当前mode
             if(mode == 'panorama'){
-                this.setVisible(false, 'isPanorama')
+                this.setVisible(false, 'isPanorama', 1)
             }else if(oldMode == 'panorama'){
                 setTimeout(()=>{
-                    this.setVisible(true, 'isPanorama')
+                    this.setVisible(true, 'isPanorama', 1)
                 },duration*0.7) 
             } 
         } 
@@ -1565,7 +1599,7 @@ function initByTHREE(THREE){
         
         setEditSelect(state){//编辑页面用
             this.editing = !!state
-            this.setVisible(state, 'editSelected', 1, state ? 'add':'cancel') //强制可见
+            this.setVisible(state, 'editSelected', 2, state ? 'add':'cancel') //强制可见
         }
         
     }