xzw před 3 roky
rodič
revize
84f126c2d9
3 změnil soubory, kde provedl 108 přidání a 16 odebrání
  1. 31 2
      js/main_2020_edit.js
  2. 70 10
      js/main_2020_show.js
  3. 7 4
      js/manage.js

+ 31 - 2
js/main_2020_edit.js

@@ -6778,6 +6778,27 @@ function o(a, s, l) {
                             $("#progressBar").find("[data-idx='" + i + "']").addClass("active")
                     }),
                     E()
+                    
+                    //add : 
+                
+                    let scrollFrame = $(W.frame)
+                    scrollFrame.on("wheel.sly", function() {
+                         lastMoveScrollTime = Date.now()
+                    })
+                    
+                    let dragstart 
+                    scrollFrame.on("pointerdown",  function() { 
+                        dragstart = true
+                    })
+                    scrollFrame.on("pointerup",  function() {
+                        dragstart = false
+                    })
+                    scrollFrame.on("pointermove",  function() {
+                        if(dragstart){
+                            lastMoveScrollTime = Date.now()
+                        }
+                    })
+                    
                 }(s, l, c) : (Ce.highlight.visible = !1,
                 Ce.tourControls.visible = !1),
                 z.on(G.OPEN_INFO, _e.bind(this, "info")),
@@ -6806,7 +6827,7 @@ function o(a, s, l) {
                         e.syntheticClick || (e.stopPropagation(),
                         "A" === e.target.nodeName && e.preventDefault())
                     }, !0)
-                }(),
+                }(), 
                 A(c),
                 C(s, t),
                 s.on("floor.changed", I),
@@ -6847,6 +6868,9 @@ function o(a, s, l) {
                         W.hide()
                     }
                 });
+                
+                var lastMoveScrollTime = 0;//add
+                
                 var o, h = $("#play").eq(0), u = $("#pause").eq(0), d = $(".pinBottom").toArray(), p = $("#drawer").eq(0), f = $("#playHead").eq(0), a = $("#progressBar").eq(0), g = $("#thumb-container").eq(0).children(), m = a.children();
                 l.on("update.controls", function() {
                     var e, t, i, n = l.describe();
@@ -6878,7 +6902,12 @@ function o(a, s, l) {
                             t.removeClass(o),
                             n.onTheBus && e === n.destinationItem[0] ? (i.addClass(r),
                             t.addClass(r),
-                            w.activate(e)) : n.onTheBus && a && e === n.currentItem[0] ? (i.addClass(r),
+                            
+                            
+                            // 如果一段时间内用户不拖拽滚动scroll,才focus回这个item
+                            (Date.now() - lastMoveScrollTime > 2000) && w.activate(e)
+                            
+                            ): n.onTheBus && a && e === n.currentItem[0] ? (i.addClass(r),
                             t.addClass(r)) : (i.removeClass(r),
                             t.removeClass(r))
                     } else

+ 70 - 10
js/main_2020_show.js

@@ -1962,7 +1962,7 @@ window.Modernizr = function(n, e, t) {
                 var a = oe(e.originalEvent);
                 (ge.scrollTrap || a > 0 && Ce.dest < Ce.end || 0 > a && Ce.dest > Ce.start) && r(e, 1),
                 ye.slideBy(ge.scrollBy * a)
-            }
+            } 
         }
         function ce(e) {
             ge.clickBar && e.target === Be[0] && (r(e),
@@ -1999,6 +1999,10 @@ window.Modernizr = function(n, e, t) {
                     T[he].call(ye, e, t)
             }
         }
+        
+        
+        
+        
         var he, me, ge = e.extend({}, n.defaults, h), ye = this, we = l(t), be = e(t), Pe = ge.slidee ? e(ge.slidee).eq(0) : be.children().eq(0), Ie = 0, ze = 0, Ce = {
             start: 0,
             center: 0,
@@ -2022,6 +2026,8 @@ window.Modernizr = function(n, e, t) {
             delta: 0,
             resetTime: 200
         }, it = 0, rt = 0, st = 0, ot = 0;
+        
+        
         we || (t = be[0]),
         ye.initialized = 0,
         ye.frame = t,
@@ -2255,7 +2261,11 @@ window.Modernizr = function(n, e, t) {
                 ge.next && Ge.on(B, se),
                 ge.prevPage && Je.on(B, se),
                 ge.nextPage && Ke.on(B, se),
-                Ue.on(C, le),
+                
+                Ue.on(C, le),// C是 "wheel.sly" 滚动监听
+                
+                
+                
                 Be[0] && Be.on(B, ce),
                 Re && ge.activateOn && be.on(ge.activateOn + "." + g, "*", ue),
                 De[0] && ge.activatePageOn && De.on(ge.activatePageOn + "." + g, "*", fe),
@@ -3670,8 +3680,9 @@ window.Modernizr = function(n, e, t) {
         }
         ,
         n.prototype.update = function(e) {
-            e || (e = 1 / 60),
-            this.rotationSpeed.multiplyScalar(1 - o.rotationFriction).addScaledVector(this.rotationAcceleration, o.rotationAccelerationOutside * e),
+            e || (e = 1 / 60)
+            var friction = Math.min(1, o.rotationFriction * e * 60) //add 如果deltaTime > 1/ 60 (比较卡),就增加rotationFriction, 以防止转动过久  
+            this.rotationSpeed.multiplyScalar(1 - friction).addScaledVector(this.rotationAcceleration, o.rotationAccelerationOutside * e),
             this.rotateLeft(-this.rotationSpeed.x),
             this.noRotateUpDown || this.rotateUp(this.rotationSpeed.y),
             this.updatePan(e);
@@ -4262,9 +4273,11 @@ window.Modernizr = function(n, e, t) {
                     this.rotationHistory.shift();
                 this.lon += this.rotationDifference.x,
                 this.lat += this.rotationDifference.y,
-                this.rotationDifference.set(0, 0),
-                this.rotationSpeed.x = this.rotationSpeed.x * (1 - a.rotationFriction) + this.rotationAcc.x * a.rotationAccelerationInside,
-                this.rotationSpeed.y = this.rotationSpeed.y * (1 - a.rotationFriction) + this.rotationAcc.y * a.rotationAccelerationInside,
+                this.rotationDifference.set(0, 0)  
+                //改
+                var friction = Math.min(1, a.rotationFriction * e * 60) //如果deltaTime > 1/ 60 (比较卡),就增加rotationFriction, 以防止转动过久  
+                this.rotationSpeed.x = this.rotationSpeed.x * (1 - friction) + this.rotationAcc.x * a.rotationAccelerationInside,
+                this.rotationSpeed.y = this.rotationSpeed.y * (1 - friction) + this.rotationAcc.y * a.rotationAccelerationInside,
                 this.lon += this.rotationSpeed.x * e,
                 this.lat += this.rotationSpeed.y * e
                 
@@ -6864,8 +6877,28 @@ window.Modernizr = function(n, e, t) {
                     $("#status").find(".curIdx").text(t + 1);
                     for (var i = 0; i <= t; i++)
                         $("#progressBar").find("[data-idx='" + i + "']").addClass("active")
-                }),
+                }), 
                 w()
+                
+                //add : 
+                
+                let scrollFrame = $(W.frame)
+                scrollFrame.on("wheel.sly", function() {
+                     lastMoveScrollTime = Date.now()
+                })
+                
+                let dragstart 
+                scrollFrame.on("pointerdown",  function() { 
+                    dragstart = true
+                })
+                scrollFrame.on("pointerup",  function() {
+                    dragstart = false
+                })
+                scrollFrame.on("pointermove",  function() {
+                    if(dragstart){
+                        lastMoveScrollTime = Date.now()
+                    }
+                })
             }
             function w() {
                 var e = $("#player").width() - 20
@@ -7042,7 +7075,7 @@ window.Modernizr = function(n, e, t) {
                         f = "recent") : (f = "active",
                         p = "recent");
                         var g = null === n.destinationItem || n.currentItem[0] === n.destinationItem[0];
-                        for (r = 0; r < e.heroLocations.length; r += 1)
+                        /* for (r = 0; r < e.heroLocations.length; r += 1)
                             s = y.eq(r),
                             a = I.eq(r),
                             s.removeClass(f),
@@ -7051,7 +7084,28 @@ window.Modernizr = function(n, e, t) {
                             a.addClass(p),
                             W.activate(r)) : n.onTheBus && g && r === n.currentItem[0] ? (s.addClass(p),
                             a.addClass(p)) : (s.removeClass(p),
-                            a.removeClass(p))
+                            a.removeClass(p)) */
+                            
+                        for (r = 0; r < e.heroLocations.length; r += 1){
+                            s = y.eq(r),
+                            a = I.eq(r),
+                            s.removeClass(f),
+                            a.removeClass(f);
+                            
+                            if(n.onTheBus && r === n.destinationItem[0]){
+                                s.addClass(p) 
+                                a.addClass(p) 
+                                if(Date.now() - lastMoveScrollTime > 2000){ //add 如果一段时间内用户不拖拽滚动scroll,才focus回这个item
+                                    W.activate(r) // scrollbar slide to this
+                                }  
+                            }else{
+                                n.onTheBus && g && r === n.currentItem[0] ? 
+                                (s.addClass(p), a.addClass(p)) : 
+                                (s.removeClass(p),  a.removeClass(p))  
+                                
+                            }  
+                        }    
+                            
                     } else
                         for (r = 0; r < e.heroLocations.length; r += 1)
                             s = y.eq(r),
@@ -7327,6 +7381,9 @@ window.Modernizr = function(n, e, t) {
                     "A" === e.target.nodeName && e.preventDefault())
                 }, !0)
             }
+            
+            var lastMoveScrollTime = 0;//add
+            
             var W, j, Y, X, Z, q, K = (e("three"),
             e("../util/ajax"),
             e("../util/browser")), Q = e("../settings"), J = e("../analytics"), ee = (e("../util/transitions"),
@@ -21827,6 +21884,9 @@ window.Modernizr = function(n, e, t) {
                       , i = g.average(e.changedTouches, "clientY");
                     this.handleInputEnd.call(this, t, i, !0)
                 }
+                //add
+                if (this.intersectHot) this.intersectHot.setHoverState(false)
+                        this.intersectHot = null
             }
             ,
             n.prototype.onPointerDown = function(e) {

+ 7 - 4
js/manage.js

@@ -286,10 +286,13 @@ var convertTool = {
 		};
 	},
 
-	ifShelter: function(pos3d , floorIndex ){//检测某点在视线中是否被mesh遮挡 
-		var ori = player.position
+	ifShelter: function (pos3d,  pos2d,  camera, floorIndex) {
+        //检测某点在视线中是否被mesh遮挡
+        if (!pos2d) pos2d = convertTool.getPos2d(pos3d )
+        camera = camera || player.camera
+        var ori = new THREE.Vector3(pos2d.x, pos2d.y, -1).unproject(camera) //找到视线原点
         var dir = pos3d.clone().sub(ori).normalize()
-        var ray = new THREE.Raycaster(ori, dir) //由外向里 因为模型从内侧是可见的所以从外侧
+        var ray = new THREE.Raycaster(ori, dir); //由外向里 因为模型从内侧是可见的所以从外侧
 	
 		/* if(config.isEdit && publicObjectSet.editor.mainDesign.editing){
 			var o = ray.intersectObjects(publicObjectSet.editor.mainDesign.wallMeshes);
@@ -1333,7 +1336,7 @@ function initByTHREE(THREE){
                     this.elem.css('display','none');	return;
                 }
                     
-                if(this.shelterByModel && convertTool.ifShelter(this.position , this.floorIndex )){
+                if(this.shelterByModel && convertTool.ifShelter(this.position , p.vector,  this.floorIndex )){
                     this.elem.css('display','none');	return; 
                 }
             }