1
0
shaogen1995 преди 2 години
родител
ревизия
dde0c154ef
променени са 2 файла, в които са добавени 158 реда и са изтрити 107 реда
  1. 157 106
      scene/public/static/js/Hot.js
  2. 1 1
      scene/public/static/js/manage.js

+ 157 - 106
scene/public/static/js/Hot.js

@@ -5,8 +5,7 @@ window.initHot = function (model) {
 
     var objLoader = new THREE.OBJLoader()
     var _planeGeometry = new THREE.PlaneGeometry(1, 1)
-    var _boxGeometry = new THREE.BoxBufferGeometry(1, 1, 1)
-    {//ie的mesh 加了polygonOffset也是会重叠。所以去掉前面的face:  (但是突然ie又播放不了videoTexture)
+    var _boxGeometry = new THREE.BoxBufferGeometry(1, 1, 1) { //ie的mesh 加了polygonOffset也是会重叠。所以去掉前面的face:  (但是突然ie又播放不了videoTexture)
         var newIndex = [..._boxGeometry.index.array]
         newIndex.splice(4 * 6, 12)
         _boxGeometry.setIndex(new THREE.BufferAttribute(new Uint16Array(newIndex), 1))
@@ -28,22 +27,29 @@ window.initHot = function (model) {
         side: THREE.DoubleSide
     })
 
-    var autoSizeInfo = { minSize: 120, maxSize: 600, nearBound: 1, farBound: 15 }
-    var hotGroup = new THREE.Object3D; hotGroup.name = "hotGroup"
-    model.add(hotGroup); model.hotGroup = hotGroup
+    var autoSizeInfo = {
+        minSize: 120,
+        maxSize: 600,
+        nearBound: 1,
+        farBound: 15
+    }
+    var hotGroup = new THREE.Object3D;
+    hotGroup.name = "hotGroup"
+    model.add(hotGroup);
+    model.hotGroup = hotGroup
 
     var animateTexSrcs = {}
 
     var getLink = function (link) {
         var src = '';
-        var r = link.substring(link.indexOf("html") + 4)
-            , o = "en" == manage.number("lang") ? "&lang=" + manage.number("lang") : "";
-        -1 == r.indexOf("?") ? src = link + "?time=" + randomTime().getTime() + "&id=" + window.number + o : src = link + "&time=" + randomTime().getTime() + "&id=" + window.number + o
+        var r = link.substring(link.indexOf("html") + 4),
+            o = "en" == manage.number("lang") ? "&lang=" + manage.number("lang") : ""; -
+        1 == r.indexOf("?") ? src = link + "?time=" + randomTime().getTime() + "&id=" + window.number + o : src = link + "&time=" + randomTime().getTime() + "&id=" + window.number + o
         // return 'http://project.4dage.com:8017' + src  // 线上测试
-        return src     //打包 
+        return src.replace('https://www.4dmodel.com/SuperTwo/hot_online1', 'hot')
 
     }
-    var removeSrcPostMark = function (url) {//去除texture.load时自动加上的'?'
+    var removeSrcPostMark = function (url) { //去除texture.load时自动加上的'?'
         var index = url.indexOf('?')
         if (index > -1) {
             return url.slice(0, index)
@@ -51,7 +57,7 @@ window.initHot = function (model) {
     }
 
 
-    {//get plane Bound
+    { //get plane Bound
         var planeBound = new THREE.Box3()
         var cornerPoint = [
             new THREE.Vector3(-0.5, 0.5, 0),
@@ -90,8 +96,8 @@ window.initHot = function (model) {
                     }
                 },
                 vertexShader: "varying vec2 vUv;\n\nvoid main() {\n\n vUv =  uv ;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",
-                fragmentShader: "varying vec3 vNormal;\n\nvarying vec2 vUv;\n\nuniform float opac;\n\nuniform vec3 color;\n\nuniform sampler2D texture1;\n\nuniform sampler2D texture2;\n\nvoid main() {\n\nvec4 tcolor1 = texture2D( texture1, vUv );\n\nvec4 tcolor2 = texture2D( texture2, vUv );\n\ngl_FragColor = mix(tcolor1,tcolor2 ,opac) + tcolor2*0.2; }\n"
-                , transparent: !0
+                fragmentShader: "varying vec3 vNormal;\n\nvarying vec2 vUv;\n\nuniform float opac;\n\nuniform vec3 color;\n\nuniform sampler2D texture1;\n\nuniform sampler2D texture2;\n\nvoid main() {\n\nvec4 tcolor1 = texture2D( texture1, vUv );\n\nvec4 tcolor2 = texture2D( texture2, vUv );\n\ngl_FragColor = mix(tcolor1,tcolor2 ,opac) + tcolor2*0.2; }\n",
+                transparent: !0
             })
             shineMats.push(mat)
             return mat
@@ -130,7 +136,7 @@ window.initHot = function (model) {
 
 
             this.sid = info.sid;
-            this.preDeal(info, source)// source:来源
+            this.preDeal(info, source) // source:来源
 
             this.info = info
             this.cornerPoints = []
@@ -205,7 +211,7 @@ window.initHot = function (model) {
                     this.addBox(!this.hasBox);
                 }
             } else {
-                this.addModel(objObject || new THREE.Mesh())//暂时创建个空的
+                this.addModel(objObject || new THREE.Mesh()) //暂时创建个空的
 
             }
 
@@ -218,7 +224,7 @@ window.initHot = function (model) {
 
 
 
-            {//gif
+            { //gif
                 if (this.animation) {
                     GifTexDeal.remove(this.animation)
                 }
@@ -324,7 +330,7 @@ window.initHot = function (model) {
 
 
 
-            if (texType == 'video') {//视频不能共用一个,否则会一起播放暂停
+            if (texType == 'video') { //视频不能共用一个,否则会一起播放暂停
                 var video
                 if (media) {
                     video = media
@@ -337,11 +343,11 @@ window.initHot = function (model) {
 
 
 
-                video.setAttribute("crossOrigin", 'Anonymous')//要在src设置好前解决跨域
+                video.setAttribute("crossOrigin", 'Anonymous') //要在src设置好前解决跨域
 
                 $(video).on('contextmenu', function () {
                     return false;
-                });//禁止右键点击出
+                }); //禁止右键点击出
 
 
                 this.texMedia = video;
@@ -368,7 +374,7 @@ window.initHot = function (model) {
                 if (media) {
                     this.texMedia = media;
                     this.info.texSrc = media.src;
-                    this.material_.map = new THREE.Texture();   //texture也不能共用一个,因为有的会有动画,就不一样
+                    this.material_.map = new THREE.Texture(); //texture也不能共用一个,因为有的会有动画,就不一样
                     this.material_.map.image = media //image可以共用
                     this.material_.map.needsUpdate = !0
 
@@ -381,10 +387,12 @@ window.initHot = function (model) {
                 if (media) {
                     this.changeShineTex(media)
                 } else {
-                    this.styleImg = /* this.styleImg || */[];
+                    this.styleImg = /* this.styleImg || */ [];
                     if (this.info.styleImg) {
                         this.styleImg = this.info.styleImg.map((src) => {
-                            return { src:/* manage.dealURL( */src } //如果要dealURL,在predeal里
+                            return {
+                                src: /* manage.dealURL( */ src
+                            } //如果要dealURL,在predeal里
                         })
                     }
                     this.changeShineTex(this.styleImg)
@@ -477,17 +485,21 @@ window.initHot = function (model) {
         sid: "1596619585929"
         transformAtPanos: {,…} */
 
-        preDeal(info, source) {// source:来源
+        preDeal(info, source) { // source:来源
 
             var convertValue = function (v, Type) {
                 var value;
                 if (v instanceof Array) {
-                    v.forEach((v1) => { v1 = parseFloat(v1) })
+                    v.forEach((v1) => {
+                        v1 = parseFloat(v1)
+                    })
                     value = new Type().fromArray(v);
                 } else {
 
                     if (!(v instanceof Type)) {
-                        for (let i in v) { v[i] = parseFloat(v[i]) }
+                        for (let i in v) {
+                            v[i] = parseFloat(v[i])
+                        }
                         value = new Type().copy(v);
                     } else {
                         value = v
@@ -504,7 +516,7 @@ window.initHot = function (model) {
             if (source == 'byHot') {
                 var infoAttribute = info.infoAttribute || {}
                 info.title = infoAttribute.title || info.title
-                info.model = infoAttribute.model || info.model || []     //模型链接
+                info.model = infoAttribute.model || info.model || [] //模型链接
                 info.images = infoAttribute.images || info.images || []
                 info.video = infoAttribute.video || info.video || []
                 info.bgName = infoAttribute.bgName || info.bgName
@@ -529,7 +541,7 @@ window.initHot = function (model) {
                 if (info.quaternion) {
                     info.rotation = new THREE.Euler().setFromVector3(convertValue(info.quaternion, THREE.Quaternion))
                 } else {
-                    info.rotation = new THREE.Euler().setFromVector3(convertValue(info.rotation, THREE.Vector3))  //热点的旧数据很多是字符串 
+                    info.rotation = new THREE.Euler().setFromVector3(convertValue(info.rotation, THREE.Vector3)) //热点的旧数据很多是字符串 
                 }
 
                 var s = Hot.getDefaulScale(info.hotIconScale)
@@ -550,7 +562,7 @@ window.initHot = function (model) {
                     //info.title = info.texType == 'video'?'视频':'图片'
 
                     info.texSrc = info.file
-                    info.actionType = CloneObject(settings.hotClickEvent[info.texType]);//给一个默认
+                    info.actionType = CloneObject(settings.hotClickEvent[info.texType]); //给一个默认
 
                     delete info.media
 
@@ -568,17 +580,19 @@ window.initHot = function (model) {
                         info.height,
                         info.depth
                     )
-                    delete info.width; delete info.height; delete info.depth;
+                    delete info.width;
+                    delete info.height;
+                    delete info.depth;
                     delete info.file
                 } else {
 
-                    info.rotation = new THREE.Euler().fromArray(info.rotation)//.setFromVector3(info.rotation) 
+                    info.rotation = new THREE.Euler().fromArray(info.rotation) //.setFromVector3(info.rotation) 
 
                 }
 
 
 
-                info.model = info.model || []     //模型链接
+                info.model = info.model || [] //模型链接
                 info.images = info.images || []
                 info.video = info.video || []
                 info.iframe = info.iframe || []
@@ -657,9 +671,10 @@ window.initHot = function (model) {
             else if (!this.info.visiblePanos) this.getVisiblePanos()
         }
 
-        getVisiblePanos() {//在不同点还不一样  
+        getVisiblePanos() { //在不同点还不一样  
             var depth = this.hasBox ? this.scale.z : 0;
-            var width = this.scale.x, height = this.scale.y
+            var width = this.scale.x,
+                height = this.scale.y
 
             var cornerPoint
 
@@ -689,7 +704,7 @@ window.initHot = function (model) {
             }
 
 
-            var getPos = (position) => {//每个overlay位置对应5个坐标,plane中心和四个角的位置
+            var getPos = (position) => { //每个overlay位置对应5个坐标,plane中心和四个角的位置
                 if (this.plane) {
                     return cornerPoint.map(e => {
                         return e.clone().applyEuler(this.info.rotation).add(position)
@@ -721,9 +736,10 @@ window.initHot = function (model) {
 
             let maxCount = browser.isMobile() ? 2000 : 5000
             let c = model.panos.list.length * model.colliders.length
-            if (window.isEdit || c < maxCount) {  //编辑页面保险起见还是全部算完后才可浏览,就能保证保存全部的visiblePano
+            if (window.isEdit || c < maxCount) { //编辑页面保险起见还是全部算完后才可浏览,就能保证保存全部的visiblePano
                 this.info.visiblePanos = common.getVisiblePano(customPositions, model.panos.list, {
-                    model: model.colliders, posAtPanos
+                    model: model.colliders,
+                    posAtPanos
                 })
 
             } else {
@@ -737,14 +753,15 @@ window.initHot = function (model) {
 
 
                     this.info.visiblePanos = this.info.visiblePanos.concat(common.getVisiblePano(customPositions, panos, {
-                        model: model.colliders, posAtPanos
+                        model: model.colliders,
+                        posAtPanos
                     }));
 
                     if (end >= model.panos.list.length) {
                         console.log(window.hotsi ? (++window.hotsi) : (window.hotsi = 1))
                         clearInterval(interval)
                     }
-                }, Hot.visiEveryDurSlice)// visiEveryDurSlice 等在main中定义
+                }, Hot.visiEveryDurSlice) // visiEveryDurSlice 等在main中定义
             }
 
         }
@@ -764,12 +781,12 @@ window.initHot = function (model) {
         }
 
 
-        getCornerPoint() {//获取在每个漫游点上的视觉边界点  可以打开boxHelper和addBall来观测是否准确
+        getCornerPoint() { //获取在每个漫游点上的视觉边界点  可以打开boxHelper和addBall来观测是否准确
             if (this.cornerPoints[player.currentPano.id]) {
                 return this.cornerPoints[player.currentPano.id]
             } else {
                 var boundPoint, cornerPoint
-                var center//中心点
+                var center //中心点
                 if (this.plane) {
                     center = this.plane.getWorldPosition()
                     boundPoint = [
@@ -801,12 +818,12 @@ window.initHot = function (model) {
                 var maxLat = -Infinity
                 var minLat = +Infinity
                 var pos1 = player.currentPano.position.clone();
-                center = this.position.clone()  //模型bound的中心点已经位移到了hot中心点。 注意不能用getWorldPosition,得到的会是偏移的
+                center = this.position.clone() //模型bound的中心点已经位移到了hot中心点。 注意不能用getWorldPosition,得到的会是偏移的
                 var dir = center.clone().sub(pos1).normalize()
                 var centerDirInfo = {}
                 player.cameraControls.controls.panorama.lookAt.call(centerDirInfo, null, dir)
 
-                boundPoint.forEach(e => {//lon左右
+                boundPoint.forEach(e => { //lon左右
                     var point = e.applyMatrix4(this.mesh.matrixWorld);
                     var dir = point.clone().sub(pos1).normalize()
                     var dirInfo = {}
@@ -814,7 +831,7 @@ window.initHot = function (model) {
                     var diffLon = (dirInfo.lon - centerDirInfo.lon) % 360
 
 
-                    if (Math.abs(diffLon) > 180) {//因为有时需要根据符号判断是在中心的左边还是右边,所以限制在180内
+                    if (Math.abs(diffLon) > 180) { //因为有时需要根据符号判断是在中心的左边还是右边,所以限制在180内
                         diffLon += (diffLon > 0 ? -360 : 360)
                     }
 
@@ -831,7 +848,7 @@ window.initHot = function (model) {
                 var diffLat = maxLat - minLat
 
 
-                if (diffLat > 180) {//可能是到了反面。不好算,直接返回所有boundPoint
+                if (diffLat > 180) { //可能是到了反面。不好算,直接返回所有boundPoint
 
                     cornerPoint = boundPoint
 
@@ -851,7 +868,7 @@ window.initHot = function (model) {
                     cornerPoint = dirs.map(e => {
                         return e.clone().add(pos1)
                     })
-                    cornerPoint = [center, ...cornerPoint]   //最后增加一个中心点
+                    cornerPoint = [center, ...cornerPoint] //最后增加一个中心点
 
 
                 }
@@ -864,7 +881,11 @@ window.initHot = function (model) {
                 //addPoints(cornerPoint)
 
 
-                this.cornerPoints[player.currentPano.id] = { cornerPoint, diffLon, diffLat }
+                this.cornerPoints[player.currentPano.id] = {
+                    cornerPoint,
+                    diffLon,
+                    diffLat
+                }
 
                 return this.cornerPoints[player.currentPano.id]
             }
@@ -888,20 +909,20 @@ window.initHot = function (model) {
 
                 var cornerPointInfo = this.getCornerPoint();
                 var cornerPoint
-                if (cornerPointInfo.diffLon < 15 && cornerPointInfo.diffLat < 15) {//当很小的时候,只判断中心点即可
+                if (cornerPointInfo.diffLon < 15 && cornerPointInfo.diffLat < 15) { //当很小的时候,只判断中心点即可
                     cornerPoint = [cornerPointInfo.cornerPoint[0]];
                 } else {
                     cornerPoint = cornerPointInfo.cornerPoint
                 }
 
-                for (let i = 0, j = cornerPoint.length; i < j; i++) {//只要有一点可见就算看见 
+                for (let i = 0, j = cornerPoint.length; i < j; i++) { //只要有一点可见就算看见 
                     var pos2d = math.getPos2d(cornerPoint[i], player.camera, $("#player")[0])
 
                     if (pos2d.trueSide && pos2d.inSight) return true
 
                 }
 
-            } else {//飞出要判断模型阻挡,有点耗时就算了
+            } else { //飞出要判断模型阻挡,有点耗时就算了
                 return true
             }
         }
@@ -910,7 +931,7 @@ window.initHot = function (model) {
 
         update(player) {
 
-            if (player.mode == 'panorama') {//实时监测播放
+            if (player.mode == 'panorama') { //实时监测播放
                 if (this.texType == "video") {
                     if (this.visible && !this.pausedByUser && this.inSight()) {
                         this.videoControl(true)
@@ -934,20 +955,24 @@ window.initHot = function (model) {
             this.updateScale()
         }
 
-        updateScale(e, t) {//自适应调节大小 
+        updateScale(e, t) { //自适应调节大小 
             if (!DATA.autoAdjustHotScale || this.texType != 'shine') return
             //let renderSize = player.sceneRenderer.renderer.domElement 
             let renderSize = player.sceneRenderer.renderer.getSize()
 
             var scale = convertTool.getScaleForConstantSize($.extend(autoSizeInfo, {
-                camera: player.camera, resolution: { x: renderSize.width, y: renderSize.height },
+                camera: player.camera,
+                resolution: {
+                    x: renderSize.width,
+                    y: renderSize.height
+                },
                 position: this.position.clone(),
             }))
             this.plane.scale.set(scale, scale, scale)
 
         }
 
-        switchPlay(state) {//手动播放暂停 
+        switchPlay(state) { //手动播放暂停 
             this.pausedByUser = !state
 
             this.videoControl(state)
@@ -1013,8 +1038,11 @@ window.initHot = function (model) {
         showTitle() {
             if (!this.titleElem) return;
             var pos = math.getPos2d(this.position, player.camera, $("#player")[0])
-            if (pos.trueSide) {//inSight
-                this.titleElem.css({ "left": `${pos.pos.x}px`, "top": `${pos.pos.y}px ` });
+            if (pos.trueSide) { //inSight
+                this.titleElem.css({
+                    "left": `${pos.pos.x}px`,
+                    "top": `${pos.pos.y}px `
+                });
                 this.titleElem.css("display", "block");
             } else {
                 this.titleElem.css("display", "none");
@@ -1029,9 +1057,9 @@ window.initHot = function (model) {
 
 
         closestPanoTowardTag(e, t) {
-            var i = []
-                , n = []
-                , r = this.mesh.getWorldPosition();
+            var i = [],
+                n = [],
+                r = this.mesh.getWorldPosition();
             if (e === "panorama") {
                 /* var o = t.position.clone().sub(r).normalize();
                 n.push(function(t, i) {//scoreFunctions.direction 最好这个漫游点在currentPano到热点之间的路径上。但是这样的话可能就看不到热点正面,所以删掉
@@ -1042,13 +1070,13 @@ window.initHot = function (model) {
             }
             var a = new THREE.Vector3;
             i.push(function (e) {
-                return Math.abs(e.position.x - r.x) > window._settings.tags.visibility.cameraClearance || Math.abs(e.position.z - r.z) > window._settings.tags.visibility.cameraClearance
-            },
+                    return Math.abs(e.position.x - r.x) > window._settings.tags.visibility.cameraClearance || Math.abs(e.position.z - r.z) > window._settings.tags.visibility.cameraClearance
+                },
 
                 function (e) {
                     a.copy(r).sub(e.position);
-                    var t = -THREE.Math.radToDeg(Math.atan(a.y / Math.sqrt(a.x * a.x + a.z * a.z)))
-                        , i = window._settings.tags.navigate.tiltTolerance
+                    var t = -THREE.Math.radToDeg(Math.atan(a.y / Math.sqrt(a.x * a.x + a.z * a.z))),
+                        i = window._settings.tags.navigate.tiltTolerance
                     return window._settings.insideLookLimitDown - i < t && t < window._settings.insideLookLimitUp + i
                 },
 
@@ -1062,15 +1090,14 @@ window.initHot = function (model) {
                 }
             )
             n.push(
-                (function (hot, i) {   //scoreFunctions.distanceSquared
+                (function (hot, i) { //scoreFunctions.distanceSquared
                     return function (pano) {
                         //i = a.navigation.distanceFactor
                         return hot ? hot.position.distanceToSquared(pano.position) * i : 0
                     }
-                })(this, -2)
-                ,
+                })(this, -2),
 
-                (pano) => {//尽量正对hot
+                (pano) => { //尽量正对hot
                     let dir = new THREE.Vector3(0, 0, 1).applyQuaternion(this.quaternion)
                     let dir2 = new THREE.Vector3().subVectors(pano.position, this.position).normalize();
                     let s = dir.dot(dir2) * 10;
@@ -1094,8 +1121,8 @@ window.initHot = function (model) {
             console.log('打开热点,关闭背景音乐');
 
             // 判断当前背景音乐是开的还是关的
-            let tempp =document.querySelector('#openMusic')
-            if(tempp.style.display==='block') {
+            let tempp = document.querySelector('#openMusic')
+            if (tempp.style.display === 'block') {
                 // 背景音乐当前为关闭状态
                 window.musicFlagNow = '音乐关'
             } else {
@@ -1127,7 +1154,8 @@ window.initHot = function (model) {
                     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.left = '17px';
+                    exit.style.top = "20px"
                     exit.style.cursor = "pointer";
                     exit.style["background-repeat"] = "no-repeat";
                     exit.style["background-size"] = "25%";
@@ -1185,14 +1213,13 @@ window.initHot = function (model) {
                     document.querySelector(".popup-content").appendChild(n);
                     var s = !1;
                     window.loaddingSuccess = function () {
-                        s = !0
-                    }
-                        ,
+                            s = !0
+                        },
                         setTimeout(function e() {
                             if (s) {
                                 var t = document.querySelector("#id1").contentWindow.document;
                                 t.querySelector("video") && (t.querySelector("video").play(),
-                                    !t.querySelector("video").paused && t.querySelector(".playPause") && t.querySelector(".playPause").classList.add("fa-pause")),
+                                        !t.querySelector("video").paused && t.querySelector(".playPause") && t.querySelector(".playPause").classList.add("fa-pause")),
                                     t.querySelector("audio") && t.querySelector("audio").play()
                             } else
                                 setTimeout(e, 300)
@@ -1213,8 +1240,8 @@ window.initHot = function (model) {
                 return;
             }
 
-            var c = this.closestPanoTowardTag(player.mode, player.currentPano) || player.currentPano
-                , h = this.mesh.getWorldPosition();
+            var c = this.closestPanoTowardTag(player.mode, player.currentPano) || player.currentPano,
+                h = this.mesh.getWorldPosition();
             player.flyingToTag = !0;
 
 
@@ -1273,7 +1300,7 @@ window.initHot = function (model) {
 
             this.setMesh(this.objObject)
             //this.adjustModelAuto()
-            if (this.info.modelBound) {//应该不会改变
+            if (this.info.modelBound) { //应该不会改变
                 var s = this.info.modelBound.scaleRatio
                 this.mesh.scale.set(s, s, s)
                 this.mesh.position.fromArray(this.info.modelBound.position)
@@ -1287,7 +1314,7 @@ window.initHot = function (model) {
         }
 
 
-        addPlane() {//换成plane
+        addPlane() { //换成plane
             if (this.plane) return
             this.plane = new THREE.Mesh(_planeGeometry, this.material_)
             this.remove(this.objObject)
@@ -1309,7 +1336,7 @@ window.initHot = function (model) {
             this.changeMaterial(this.material_) //re applyTo every mesh
 
             this.mesh.traverse((mesh) => {
-                mesh.type = "hotSprite"    //raycaster use
+                mesh.type = "hotSprite" //raycaster use
             })
 
             if (!this.mesh.boxHelper) {
@@ -1364,10 +1391,11 @@ window.initHot = function (model) {
                 if (this.photoHasRequestLoad || this.texType != 'photo') return;
                 //console.log('overlay beginDownload : ' + this.sid)
 
-                /* this.material_.map =  */Texture.load(this.info.texSrc, (tex) => {
+                /* this.material_.map =  */
+                Texture.load(this.info.texSrc, (tex) => {
                     callback && callback()
                     if (!tex.image) {
-                        return  //只是单纯用了相同src的tex,但image仍未加载完
+                        return //只是单纯用了相同src的tex,但image仍未加载完
                     }
                     if (!this._loadDones) return
                     dealMap(tex)
@@ -1383,7 +1411,7 @@ window.initHot = function (model) {
 
                             e.texMedia = tex.image
 
-                            {//animation不同致使的不能使用同一个texture 
+                            { //animation不同致使的不能使用同一个texture 
                                 if (window.isEdit) {
                                     if (animateTexSrcs[e.info.texSrc]) {
                                         e.material_.map = tex.clone(); //编辑动画直接不用一个texture, 故而animation也不同
@@ -1394,11 +1422,13 @@ window.initHot = function (model) {
                                         animateTexSrcs[e.info.texSrc] = 1
                                     }
                                 } else {
-                                    if (animateTexSrcs[e.info.texSrc]) {//已有该texSrc 
+                                    if (animateTexSrcs[e.info.texSrc]) { //已有该texSrc 
                                         let finded = false
                                         for (let i of animateTexSrcs[e.info.texSrc]) {
                                             if (ifSame(i[0], e.info.animateInfo)) {
-                                                e.material_.map = i[1]; finded = true; break;
+                                                e.material_.map = i[1];
+                                                finded = true;
+                                                break;
                                             }
                                         }
                                         if (!finded) {
@@ -1409,7 +1439,7 @@ window.initHot = function (model) {
                                     } else {
                                         let object = new Map();
                                         object.set(e.info.animateInfo, tex)
-                                        animateTexSrcs[e.info.texSrc] = object//注册第一个texSrc
+                                        animateTexSrcs[e.info.texSrc] = object //注册第一个texSrc
                                         e.material_.map = tex
                                     }
 
@@ -1422,7 +1452,7 @@ window.initHot = function (model) {
                                 e.visible && e.inSight() && GifTexDeal.start(e.animation)
                             }
 
-                            if (++photoLoaded == originPhotoCount) {//data2.js中的所有photo加载完毕
+                            if (++photoLoaded == originPhotoCount) { //data2.js中的所有photo加载完毕
                                 Hot.allPhotoLoaded = true;
                                 Hot.whenAllFileLoaded && Hot.allModelLoaded && Hot.whenAllFileLoaded()
                             }
@@ -1454,7 +1484,7 @@ window.initHot = function (model) {
                     this.addModel(object)
 
                     callback && callback()
-                    if (++modelLoaded == originModelCount) {//data2.js中的所有photo加载完毕
+                    if (++modelLoaded == originModelCount) { //data2.js中的所有photo加载完毕
                         Hot.allModelLoaded = true;
                         Hot.whenAllFileLoaded && Hot.allPhotoLoaded && Hot.whenAllFileLoaded()
                     }
@@ -1499,7 +1529,7 @@ window.initHot = function (model) {
     var loadings = [];
     Hot.loadQueue = []; //等待下载的overlay,目前只针对photo
     Hot.maxLoadingCount = 3; //同时正在load图片的数量
-    Hot.loadNext = () => {//继续requestDownload  loadQueue中前排的item
+    Hot.loadNext = () => { //继续requestDownload  loadQueue中前排的item
         let count = Hot.maxLoadingCount - loadings.length
         Hot.loadQueue.slice(0, count).forEach(e => {
             loadings.push(e)
@@ -1512,7 +1542,7 @@ window.initHot = function (model) {
         Hot.loadQueue.splice(0, count)
     }
 
-    Hot.getNeedLoad = function () {//计算获取loadQueue,每次都重新计算,覆盖旧的
+    Hot.getNeedLoad = function () { //计算获取loadQueue,每次都重新计算,覆盖旧的
         if (!player || !player.domElement || !player.mode)
             return;
         var hots1, hots2
@@ -1522,8 +1552,18 @@ window.initHot = function (model) {
             if (Hot.loadQueue.length == 0) {
                 hots1 = model.hotGroup.children.filter(e => e.texType == 'photo' && !e.photoHasRequestLoad)
                 hots2 = model.hotGroup.children.filter(e => e.info.objSrc && !e.modelHasRequestLoad)
-                Hot.loadQueue = hots1.map(e => { return { hot: e, type: "photo" } }).concat(
-                    hots2.map(e => { return { hot: e, type: "model" } })
+                Hot.loadQueue = hots1.map(e => {
+                    return {
+                        hot: e,
+                        type: "photo"
+                    }
+                }).concat(
+                    hots2.map(e => {
+                        return {
+                            hot: e,
+                            type: "model"
+                        }
+                    })
                 )
             }
             return
@@ -1544,8 +1584,18 @@ window.initHot = function (model) {
 
         var cameraDir = player.getDirection()
 
-        Hot.loadQueue = hots1.map(e => { return { hot: e, type: "photo" } }).concat(
-            hots2.map(e => { return { hot: e, type: "model" } })
+        Hot.loadQueue = hots1.map(e => {
+            return {
+                hot: e,
+                type: "photo"
+            }
+        }).concat(
+            hots2.map(e => {
+                return {
+                    hot: e,
+                    type: "model"
+                }
+            })
         )
 
         var request = [(item) => {
@@ -1554,18 +1604,17 @@ window.initHot = function (model) {
         var rank = [(item) => {
             var dis = item.hot.mesh.getWorldPosition().distanceTo(player.position);
             return -dis
-        }
-            , (item) => {
-                var tagDir = item.hot.mesh.getWorldPosition().sub(player.position)
-                var angle = tagDir.angleTo(cameraDir)
-                return -angle * 20
-            }]
+        }, (item) => {
+            var tagDir = item.hot.mesh.getWorldPosition().sub(player.position)
+            var angle = tagDir.angleTo(cameraDir)
+            return -angle * 20
+        }]
         var result = common.sortByScore(Hot.loadQueue, request, rank);
         //Hot.loadQueue = result ? result.slice(0, 5).map(e=>e.item) : model.hotGroup.children.filter(e=>e.texType == 'photo' && !e.hasRequestLoad).slice(0, 2);
         Hot.loadQueue = result ? result.slice(0, 5).map(e => e.item) : []
     }
 
-    Hot.load = () => {//开始下载图片
+    Hot.load = () => { //开始下载图片
         Hot.getNeedLoad()
         Hot.loadNext()
         var hots1 = model.hotGroup.children.filter(e => e.texType == 'photo' && !e.photoHasRequestLoad)
@@ -1583,7 +1632,7 @@ window.initHot = function (model) {
         originModelCount = hotGroup.children.filter(e => !!e.info.objSrc).length
         if (originPhotoCount == 0) Hot.allPhotoLoaded = true
         if (originModelCount == 0) Hot.allModelLoaded = true;
-        if (Hot.allModelLoaded && Hot.allPhotoLoaded) Hot.whenAllFileLoaded && Hot.whenAllFileLoaded()//所有加载完毕
+        if (Hot.allModelLoaded && Hot.allPhotoLoaded) Hot.whenAllFileLoaded && Hot.whenAllFileLoaded() //所有加载完毕
         else {
             Hot.load()
         }
@@ -1611,12 +1660,12 @@ window.initHot = function (model) {
 
 
 
-    Hot.closePopup = () => {// 关闭热点页面
+    Hot.closePopup = () => { // 关闭热点页面
         if (!g_currentHot) return;
 
         console.log('关闭热点,打开背景音乐');
-        if(window.musicFlagNow === '音乐开') SoundManager.play('bgm')
-        
+        if (window.musicFlagNow === '音乐开') SoundManager.play('bgm')
+
         g_currentHot = null;
         var hotPop = document.getElementById('popup');
         hotPop.style.display = "none";
@@ -1624,7 +1673,7 @@ window.initHot = function (model) {
         $("#popup iframe:last").remove();
 
 
-        SoundManager.pause('hot', true)//自动播放被中断的音频 (bgm
+        SoundManager.pause('hot', true) //自动播放被中断的音频 (bgm
 
 
         return false
@@ -1642,7 +1691,9 @@ window.initHot = function (model) {
     Hot.createHotList = function () {
         var docFragment = document.createDocumentFragment();
         var hots = hotGroup.children.filter(hot => hot.info.actionType.openHot);
-        hots = hots.sort((a, b) => { return a.order - b.order });
+        hots = hots.sort((a, b) => {
+            return a.order - b.order
+        });
         window.myHotList = hots
         console.log(123, window.myHotList);
         hots.forEach((hot) => {
@@ -1650,7 +1701,7 @@ window.initHot = function (model) {
             var span = document.createElement('span');
             span.innerHTML = hot.info.title || '热点';
             // console.log(span.innerHTML);
-            li.hot = hot;   // 列表每一项对应一个热点
+            li.hot = hot; // 列表每一项对应一个热点
             li.appendChild(span);
             docFragment.appendChild(li);
 

+ 1 - 1
scene/public/static/js/manage.js

@@ -1104,7 +1104,7 @@ var SoundManager = {//暂不支持同时播放
 function Log(value, color, fontSize){
     color = color || '#13f'
     fontSize = fontSize || 14
-    console.warn(`%c${value}`, `color:${color};font-size:${fontSize}px`) 
+    // console.warn(`%c${value}`, `color:${color};font-size:${fontSize}px`) 
 }