Przeglądaj źródła

制作复合热点之前

xzw 3 lat temu
rodzic
commit
eace19e942
13 zmienionych plików z 2474 dodań i 225990 usunięć
  1. 17 1
      css/lzb.css
  2. 76 6
      edit.html
  3. 520 124
      js/edit.js
  4. 1307 0
      js/lib/OBJLoader.js
  5. 0 59689
      js/mainEdit.js
  6. 0 54405
      js/main_2018.js
  7. 0 55949
      js/main_2018_edit.js
  8. 0 55691
      js/main_2019.js
  9. 81 44
      js/main_2020_edit.js
  10. 183 59
      js/main_2020_show.js
  11. 155 0
      js/manage.js
  12. 3 1
      js/myShow.js
  13. 132 21
      js/overlay.js

+ 17 - 1
css/lzb.css

@@ -305,10 +305,11 @@ ul.MenuOptions li.chosen {
 }
 
 .toolRight .editText {
-    height: 200px !important;
+    min-height: 200px !important;
     line-height: 130% !important;
     padding: 10px;
     text-align: justify;
+    resize: vertical;
 }
 
 @keyframes warnFlash {
@@ -1921,4 +1922,19 @@ ul.MenuOptions li.chosen {
     width: 45px !important;
     height: 45px !important;
     margin:1px;
+}
+
+
+.toolRight #gifInfoEdit{
+    text-align : left; 
+}
+.toolRight #gifInfoEdit input {
+    width: 49px;
+    height:25px;
+    margin:0 4px;
+    padding: 0 1px;
+    text-align: center;
+}
+.toolRight #gifInfoEdit span {
+    margin:0 3px;  
 }

+ 76 - 6
edit.html

@@ -103,6 +103,10 @@
                         <span class="panoVisible"></span>
                         <label>小地图</label>
                     </li>
+                    <li data-name="panoLog">
+                        <span class="panoVisible"></span>
+                        <label>漫游点位</label>
+                    </li>
                 </ul>
             </div>
             <div class="toolMid">
@@ -934,7 +938,7 @@
                                 <span>热点大小 (初始值为1)</span>
                             </div>
                             <ul id="hotIconScale" class="clearfix hotStyle-item colorWrap">
-                                <input class="" type="number" placeholder="请输入热点大小比例" value="1" max="1.5" min="0.1"
+                                <input class="" type="number" placeholder="请输入热点大小比例" value="1" max="100" min="0.1"
                                     step="0.1">
                             </ul>
                         </li>
@@ -1046,7 +1050,7 @@
                                     </ul>
                                     <div id="userHotScale" class="hide">
                                         <ul id="hotIconScale_2" class="clearfix hotStyle-item colorWrap">
-                                            <input class="" type="number" placeholder="请输入热点大小比例" value="1" max="1.5" min="0.1" step="0.1">
+                                            <input class="" type="number" placeholder="请输入热点大小比例" value="1" max="100" min="0.1" step="0.1">
                                         </ul>
                                     </div>
                                 </li>
@@ -1364,6 +1368,14 @@
                                     <label for="hideMouseMarker">隐藏鼠标标记 </label>
                                 </li>
                                 <li>
+                                    <input name="showingLabels" class="editCheckbox" type="checkbox"
+                                        value="showingLabels" id="showingLabels">
+                                    <label for="showingLabels"></label>
+                                    <label for="showingLabels">加载俯视图区域标签</label>
+                                </li>
+                                
+                                
+                                <li>
                                     <input name="g_specialScene" class="editCheckbox" type="checkbox"
                                         value="g_specialScene" id="g_specialScene">
                                     <label for="g_specialScene"></label>
@@ -1588,8 +1600,7 @@
                             </ul>
                         </li>
                     </ul>
-                </div>
-                <div class="wallDesign content hide"></div>
+                </div> 
                 <div class="panoVisible content hide">
                     <ul class="view-setting">
                         <li>
@@ -1599,6 +1610,30 @@
                         </li>
                     </ul>
                 </div>
+                
+                <div class="panoLog content hide">
+                    <ul class="view-setting">
+                        <li>
+                            <!-- <div class="itemTitle"><span>漫游点位</span></div> -->
+                            <div class="remark">此面板会展示选中的漫游点id</div> 
+                            <textarea placeholder="请选择漫游点" id="panosIdShow" readonly="readonly" class="editText"></textarea>
+                            
+                             
+                        </li>
+                        <li>
+                        <div class="itemTitle"><span>点位标签颜色</span></div>
+                            <ul class="clearfix  colorWrap">
+                                <input id="panoIdColorTex" class="color-text" type="text"  />
+                                <input id="panoIdColor" type="color" />
+                            </ul>
+                        
+                        </li>
+                    </ul>
+                </div>
+                
+                
+                
+                
                 <div class="overlay content hide">
                     <ul>
                         <li class="addBtn">
@@ -1650,8 +1685,31 @@
                                 </ul>
                                 
                             </li>
-
-
+                            <li id="gifEdit">
+                                <div class="itemTitle">
+                                    <span data-lang="">设置动画</span> 
+                                </div>
+                                
+                                <ul id="gifSwitch" class="switch clearfix hotStyle-item colorWrap">
+                                    <label><input class="mui-switch mui-switch-animbg" type="checkbox">
+                                        是否开启
+                                    </label> 
+                                </ul>
+                                
+                                <div id="gifInfoEdit" style='display:none'>
+                                    横向 <input id="gifXCount"></input> 帧 ( 宽<input id="gifCellWidth">px )<br>
+                                    纵向 <input id="gifYCount"></input> 帧 ( 高<input id="gifCellHeight">px )<br>
+                                    末尾空缺 <input id="voidCount"></input> 帧 <br>
+                                    
+                                    共<span id='gifFrameCount'></span>帧,总宽<span id='gifImgWidth'></span>px, 总高<span id='gifImgHeight'></span>px<br>
+                                    时长 <input id="gifDuration"></input> 秒( 帧率 <input id="gifFps" style=></input> )<br>
+                                    
+                                    <!-- <input  class="editCheckbox" type="checkbox" value="loadlogo" id="loopGif"></input> -->
+                                </div>
+                                
+                                <label class="remark">注:1 精灵贴图的排列顺序为从左到右、从上到下。   2 图片最长边尽量不大于2048px,因部分手机gpu性能有限。 </label>
+                                
+                            </li>
 
                             <li>
                                 <div class="itemTitle">
@@ -1659,6 +1717,17 @@
                                 </div>
                                 <div id="videoDepth"></div>
                             </li>
+                            
+                            <li id='overlayModel'>
+                                <div class="itemTitle">
+                                    <span data-lang="">替换展板模型</span>
+                                </div>
+                                <div class="buttons" name="upload">
+                                    <button class="innerBtn" data-lang="">上传模型  (obj,<500k)</button>
+                                </div>
+                            </li>
+                            
+                            
                         </ul>
                     </div>
                     <div class="buttons tail">
@@ -1777,6 +1846,7 @@
     <script src="js/edit.js"></script>
     <script src="js/overlay.js"></script>
     <script src="js/TransformControls.js"></script>
+    <script src="js/lib/OBJLoader.js"></script>
     <script src="js/main_2020_edit.js"></script>
     <script src="js/loadCAD.js"></script>
 </body>

+ 520 - 124
js/edit.js

@@ -98,37 +98,45 @@ EditTools.prototype.active = function() {
         console.log(`atPanel ${that.atPanel} name ${name}`)
         switch (that.atPanel) {
             //退出
-        case "panoVisible":
-            VisiSet.finishSetPanoVisible()
-            break;
-        case "screen":
-            confirmSnap.addClass("hide").removeClass("unable");
-            snapshotGui.hide();
-            break;
-        case "overlay":
-            EditOverlay.leave()
-            break;
-        case "hotpoint":
-            $("#hotpointDetail").hasClass("atRight") || $("#hotpointDetail a.close").click();
-            VisiSet.finishSetTagVisible()
-            break;
+            case "panoVisible":
+                VisiSet.finishSetPanoVisible()
+                break;
+            case "panoLog":
+                VisiSet.finishSetPanoLog()
+                break;    
+            case "screen":
+                confirmSnap.addClass("hide").removeClass("unable");
+                snapshotGui.hide();
+                break;
+            case "overlay":
+                EditOverlay.leave()
+                break;
+            case "hotpoint":
+                $("#hotpointDetail").hasClass("atRight") || $("#hotpointDetail a.close").click();
+                VisiSet.finishSetTagVisible()
+                break;
         }
         switch (name) {
-        case "panoVisible":
-            $(".toolLeft").addClass("unable")
-            VisiSet.enterSet(VisiSet.beginSetPanoVisible.bind(VisiSet))
+            case "panoVisible":
+                $(".toolLeft").addClass("unable")
+                VisiSet.enterSet(VisiSet.beginSetPanoVisible.bind(VisiSet))
 
-            break;
-        case "screen":
-            confirmSnap.removeClass("hide");
-            $('#camera-start').text("点此设置为初始画面")
-            snapshotGui.show();
-            if (player.modeTran.split("-")[1] != "panorama")
-                $(".confirmSnap").addClass("unable")
-            break;
-        case "overlay":
-            EditOverlay.enter()
-            break;
+                break;
+            case "panoLog":
+                $(".toolLeft").addClass("unable")
+                VisiSet.enterSet(VisiSet.beginSetPanoLog.bind(VisiSet))
+
+                break;    
+            case "screen":
+                confirmSnap.removeClass("hide");
+                $('#camera-start').text("点此设置为初始画面")
+                snapshotGui.show();
+                if (player.modeTran.split("-")[1] != "panorama")
+                    $(".confirmSnap").addClass("unable")
+                break;
+            case "overlay":
+                EditOverlay.enter()
+                break;
         }
 
         that.atPanel = name;
@@ -203,13 +211,7 @@ EditTools.prototype.initSaveAll = function() {
                     if(hot.transformAtPanos[i].qua){
                         hotData.transformAtPanos[i].qua = toPrecision(hot.transformAtPanos[i].qua.toArray(), 5)  
                     }
-                }
-                
-                
-                         
-                                    
-                  
-                
+                } 
                 
                 if (hot.infoAttribute) {
                     delete hot.infoAttribute.position;
@@ -239,6 +241,8 @@ EditTools.prototype.initSaveAll = function() {
                 hideFloorMarker: $("#hideFloorMarker").is(':checked'),
                 // 地面标记
                 hideMouseMarker: $("#hideMouseMarker").is(':checked'),
+              
+                showingLabels: $("#showingLabels").is(':checked'),
                 // 鼠标标记
                 floorMarkerColor: $('#floorMarkerColor').val(),
                 // 地面/导览标志颜色
@@ -266,8 +270,8 @@ EditTools.prototype.initSaveAll = function() {
                 var info = EditOverlay.getSavingInfo(overlay)
                 if (info)
                     overlayInfo.push(info);
-            }
-            )
+            })
+            
                 
      
         
@@ -303,14 +307,17 @@ EditTools.prototype.initSaveAll = function() {
                     overlays: reData(overlayInfo, '[]')
                 }),
                 success: function(data) {
-                    if (data.code === 0) {
+                    if (data.code === 0) {//成功
+                        //manage.showInfo("保存成功")
                         location.reload()
-                    }
-                    if (data.code === 5001) {
+                    }else if (data.code === 5001) {
                         alert('请重新登录')
                         localStorage.dcj_token = ''
                         location.reload()
+                    }else{
+                        alert(`saveAll  (url:${url})  code : ${data.code}  \n${data.msg}`) 
                     }
+                    
                 }
 
             })
@@ -329,6 +336,7 @@ SceneInformation.prototype.init = function(data, data2) {
     var $hotImageScale = $("#hotImgScale");
     var $hideFloorMarker = $("#hideFloorMarker");
     var $hideMouseMarker = $("#hideMouseMarker");
+    var $showingLabels = $("#showingLabels");
     var $g_specialScene = $("#g_specialScene");
     var $twoData = $("#twoData");
 
@@ -397,7 +405,7 @@ SceneInformation.prototype.init = function(data, data2) {
         hotIconScale.val(parseFloat(data.hotIconScale));
     }
     hotIconScale.on('change',(e)=>{
-        var s = THREE.Math.clamp(parseFloat(e.target.value), 0.1, 1.5)
+        var s = THREE.Math.clamp(parseFloat(e.target.value), 0.1, 100)
         e.target.value = s
         
         for(let i in player.model.hots){
@@ -407,7 +415,7 @@ SceneInformation.prototype.init = function(data, data2) {
         }
     })
     $('#hotIconScale_2 input').on('change',(e)=>{
-        var s = THREE.Math.clamp(parseFloat(e.target.value), 0.1, 1.5)
+        var s = THREE.Math.clamp(parseFloat(e.target.value), 0.1, 100)
         e.target.value = s
         editTool.hotpoint.editSpot.mesh.scale.set(s,s,s)  
     })
@@ -439,7 +447,10 @@ SceneInformation.prototype.init = function(data, data2) {
     if (data.hideMouseMarker) {
         $hideMouseMarker[0].checked = true
     }
-
+     
+    if (data.showingLabels) {
+        $showingLabels[0].checked = true
+    }
     //特殊大场景
     if (data.special) {
         $g_specialScene[0].checked = true
@@ -471,14 +482,14 @@ function initColorElem(data, elem) {
 
     // 事件监听
     $floorMarkerColor.on('change', function(e) {
-        $('#floorMarkerColorTex').attr('placeholder', e.target.value)
+        $('#floorMarkerColorTex').val(e.target.value)
     })
 
     $floorMarkerColorTex.on('blur keydown', function(e) {
         (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $floorMarkerColor, this);
     })
     $mouseMarkerColor.on('change', function(e) {
-        $('#mouseMarkerColorTex').attr('placeholder', e.target.value)
+        $('#mouseMarkerColorTex').val(e.target.value)
 
     })
     $mouseMarkerColorTex.on('blur keydown', function(e) {
@@ -487,7 +498,7 @@ function initColorElem(data, elem) {
     
     // 事件监听
     $cadSignColor.on('change', function(e) {
-        $('#cadSignColorTex').attr('placeholder', e.target.value)
+        $('#cadSignColorTex').val( e.target.value)
     })
     
     $cadSignColorTex.on('blur keydown', function(e) {
@@ -496,7 +507,7 @@ function initColorElem(data, elem) {
     
     // 事件监听
     $cadBorderColor.on('change', function(e) {
-        $('#cadBorderColorTex').attr('placeholder', e.target.value)
+        $('#cadBorderColorTex').val( e.target.value)
     })
     
     $cadBorderColorTex.on('blur keydown', function(e) {
@@ -527,6 +538,19 @@ function initColorElem(data, elem) {
     if (data.showCad) {
         $('input[name="show-cad"]').trigger('change')
     }
+    
+    
+      
+    $('#panoIdColor').on('change', function(e) {
+        $('#panoIdColorTex').val(e.target.value)
+        VisiSet.changePanoIdColor(e.target.value)
+    })
+    $('#panoIdColorTex').on('blur keydown', function(e) {
+        (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $('#panoIdColor'), this);
+        VisiSet.changePanoIdColor(e.target.value)
+    })
+    $('#panoIdColor').val('#c13e3e')//初始颜色
+    $('#panoIdColorTex').val('#c13e3e')
 }
 
 
@@ -866,7 +890,7 @@ Hotpoint.prototype.initTexSelect = function(hots) {//热点样式图列表
      
     var hotIcons = [];  // 从所有热点tex中搜集
     for(let i in hots){
-        let imgs = hots[i].infoAttribute.styleImg;
+        let imgs = hots[i].infoAttribute && hots[i].infoAttribute.styleImg;
         if(imgs && imgs.length){ 
             if(!hotIcons.find(e=>e[0] == imgs[0] && e[1] == imgs[1])){ 
                 hotIcons.push(imgs)
@@ -1502,7 +1526,7 @@ Hotpoint.prototype.inputList = function(text, val) {
 }
 //添加热点模型
 Hotpoint.prototype.addModel = function() {
-    var text = this.inputList("请填写模型链接");
+    var text = this.inputList("请填写模型链接(https开头)");
     this.hotpointDetail.find(".model .add").on('click', function() {
         $(this).closest(".model").find(".list").append(text)
     });
@@ -2567,13 +2591,18 @@ function uploadFile(file, type, callback, fileName) {
         contentType: false,
         //必须
         success: function(rs) {
-            if (rs.code === 5001) {
+            if(rs.code === 0){
+                callback(rs, file);
+                $(".edit-loading").addClass("hide");
+            }else if (rs.code === 5001) {
                 alert('请重新登录')
                 localStorage.dcj_token = ''
-                location.reload()
+                location.reload() 
+            }else{
+                alert(`uploadFile (url:${url}) code : ${rs.code}  \n${rs.msg}`) 
+                
             }
-            callback(rs, file);
-            $(".edit-loading").addClass("hide");
+            
         }
     })
 }
@@ -2726,16 +2755,16 @@ var eachMaxWeights = {
     "photo": 10,
     "video": 1000,//50,  expand size for overlayVideo 
     //20,
-    "audio": 10 //5
+    "audio": 10, //5
+    "model": 1 //5
 }
 
 var supportTypes = {
     //支持后缀
     "photo": ["jpg", "png", "jpeg", "bmp", "gif"],
-    "audio": ["mp3", "aac", "ogg", "wav"/* , "m4a" */
-    ],
-    "video": ["mp4", "mov"/* ,"webm", "rmvb", "wmv" */
-    ]//ios:mov
+    "audio": ["mp3", "aac", "ogg", "wav"/* , "m4a" */],
+    "video": ["mp4", "mov"/* ,"webm", "rmvb", "wmv" */],//ios:mov
+    'model':["obj"]
 }
 function getExt(name) {
     //后缀
@@ -2805,7 +2834,8 @@ var inputMedia = function(options, type, e) {
     var chType = {
         "photo": '图片',
         "video": '视频',
-        "audio": '音乐'
+        "audio": '音乐',
+        'model': '模型'
     }
 
     var overWeight = detectWeights(file, inputType);
@@ -2843,16 +2873,34 @@ var inputMedia = function(options, type, e) {
         alert(`文件出错, 无法加载此${chType[inputType]}文件。 文件可能损坏,或者浏览器不支持,或者后缀与文件不匹配。建议在IE以外的浏览器上传`)
     }
 
-    deal();
+    deal(type);
 
-    function deal(fi) {
+    function deal(type) {
         console.log('开始deal文件')
         var reader = new FileReader();
         //reader.name = file.name;
-
-        file = fi || file;
-        reader.readAsDataURL(file);
+        if(type == 'model'){
+            reader.readAsText( file );
+        }else{
+            reader.readAsDataURL(file);
+        }
+    
         reader.onload = function(evt) {
+            
+            if (inputType == "model") { 
+                var object = new THREE.OBJLoader().parse( evt.target.result );
+                object.name = file.name;
+                player.model.add(object)
+                 
+                
+                //object.children[5].position.set(0,10,0) 
+                window.extModel = object
+                $('.waiting').removeClass('showloading');                
+                return;
+            }
+            
+            
+            
             var blob = dataURLtoBlob(evt.target.result);
             var blobSrc = window.URL.createObjectURL(blob);
 
@@ -3383,7 +3431,8 @@ var EditOverlay = {
 
         var uploadInputs = {
             video : $('<input  type="file" style="display:none" accept="video/*"></input>'),
-            photo : $('<input  type="file" style="display:none" accept="image/*"></input>')
+            photo : $('<input  type="file" style="display:none" accept="image/*"></input>'),
+            model: $('<input  type="file" style="display:none" accept=".obj, .OBJ"></input>'),
         }
        
         $('#overlayUpload [name="upload"] button').on('click', ()=>{
@@ -3439,6 +3488,16 @@ var EditOverlay = {
                     //$('#overlayUpload .preview').css('background-image',"").append($(video));
                    
                     this.useImgRatio()
+                    this.updateGifPanel(this.editPlane)
+                    
+                    if(this.editPlane.animateInfo){
+                        GifTexDeal.remove(this.editPlane.animation)
+                        this.editPlane.animation = GifTexDeal.addAnimation(this.editPlane.plane.material.map, this.editPlane, this.editPlane.animateInfo, this.editPlane.sid)
+                        GifTexDeal.start(this.editPlane.animation)
+                    }
+                   
+                   
+                    
                     //自适应比例 
                     this.editPlane.file = photo.file;
                     plane.material.opacity = 1;
@@ -3450,7 +3509,21 @@ var EditOverlay = {
             }
         )
         
- 
+        
+        //模型
+        uploadInputs.model.on("change", (e)=>{ 
+            inputMedia({
+                //enableTypes: [this.editType ],
+                modelDone: (obj)=>{
+                   console.log(obj)
+                }
+            }, "model", e);
+             
+        })
+        
+        $('#overlayModel [name="upload"] button').on('click', ()=>{
+            uploadInputs['model'].click()
+        })
         
         player.overlayGroup.children.forEach((overlay)=>{
             if(!overlay.plane.material.map || !overlay.plane.material.map.image){
@@ -3461,9 +3534,197 @@ var EditOverlay = {
             }
               
             this.addToList(overlay)
-        }
-        )
+        } )
         
+        $("#gifSwitch input").on("change",  (e)=>{
+            var on = $("#gifSwitch input").is(':checked');
+            $("#gifInfoEdit").css({display: on ? 'block' : 'none'})
+            if(on){
+                EditOverlay.editPlane.animateInfo = {
+                    cellXcount : parseInt($("#gifXCount").val()),
+                    cellYcount : parseInt($("#gifYCount").val()),
+                    voidCount : parseInt($("#voidCount").val()), 
+                    loop : true,
+                    duration : parseFloat($("#gifDuration").val()) * 1000
+                }  
+                EditOverlay.editPlane.animation = GifTexDeal.addAnimation(EditOverlay.editPlane.plane.material.map, EditOverlay.editPlane, EditOverlay.editPlane.animateInfo, EditOverlay.editPlane.sid)       
+                GifTexDeal.start(EditOverlay.editPlane.animation)
+            }else{
+                GifTexDeal.remove(EditOverlay.editPlane.animation) 
+                EditOverlay.editPlane.animateInfo = null
+            }
+        })  
+
+        
+        {//gif动画  input
+        
+            let strictInputNum = function(e, precision, min=0,max){//precision:保留小数位数
+                var value = e.target.value.trim(); 
+                var lastOne = value[value.length-1];
+                var preContent = value.substr(0,value.length-1)
+                var hasPoint = precision > 0 && lastOne == '.' ; 
+                 
+                var a = Math.pow(10, precision)
+                value = parseFloat(value) || 0;
+                if(isNaN(value)){
+                    e.target.value = preContent //还原
+                    return
+                }
+                e.target.value =  Math.max(min, parseInt(value * a) / a )
+                
+                hasPoint && (e.target.value += '.')//补小数点
+            }
+            let changeAnimation = function(){
+                GifTexDeal.setRepeart(EditOverlay.editPlane.animation)
+               
+            }
+            let restartAnimation = function(){
+                GifTexDeal.stop(EditOverlay.editPlane.animation)
+                GifTexDeal.start(EditOverlay.editPlane.animation)
+            }
+            let changeFrameCount = function(){
+                var a = EditOverlay.editPlane.animateInfo
+                var frameCount = a.cellXcount * a.cellYcount - (a.voidCount||0)
+                $("#gifFrameCount").text(frameCount)
+                var fps = parseFloat($("#gifFps").val())
+                a.duration = frameCount / fps * 1000
+                $("#gifDuration").val(toPrecision(a.duration/1000, 2)) 
+            }
+            
+            let gifXCountFun = function(value){
+                EditOverlay.editPlane.animateInfo.cellXcount = value 
+                var gifImgWidth = parseFloat($("#gifImgWidth").text())
+                var gifCellWidth = toPrecision(gifImgWidth / EditOverlay.editPlane.animateInfo.cellXcount,1);
+                $("#gifCellWidth").val(gifCellWidth)
+                changeFrameCount()
+                changeAnimation()
+            }
+           
+            $("#gifXCount").on('input',(e)=>{
+                strictInputNum(e, 0) 
+                gifXCountFun(parseFloat(e.target.value))
+                
+            })
+            $("#gifXCount").on('change',(e)=>{
+                strictInputNum(e, 0, 1) 
+                gifXCountFun(parseFloat(e.target.value))
+                restartAnimation()
+            })
+            
+            
+            let gifYCountFun = function(value){
+                EditOverlay.editPlane.animateInfo.cellYcount = value 
+                var gifImgHeight = parseFloat($("#gifImgHeight").text())
+                var gifCellHeight = toPrecision(gifImgHeight / EditOverlay.editPlane.animateInfo.cellYcount,1);
+                $("#gifCellHeight").val(gifCellHeight)
+                changeFrameCount()
+                changeAnimation()
+            }
+            $("#gifYCount").on('input',(e)=>{
+                strictInputNum(e, 0)
+                gifYCountFun(parseFloat(e.target.value))
+            })
+            $("#gifYCount").on('change',(e)=>{
+                strictInputNum(e, 0, 1)
+                gifYCountFun(parseFloat(e.target.value))
+                changeAnimation()
+                restartAnimation()
+            })
+          
+          
+            let gifCellWidthFun = function(value){
+                var gifCellWidth = value;
+                var gifImgWidth = parseFloat($("#gifImgWidth").text())
+                var cellXcount = toPrecision(gifImgWidth / gifCellWidth,2);
+                $("#gifXCount").val(cellXcount)
+                changeAnimation()
+            }
+            $("#gifCellWidth").on('input',(e)=>{
+                strictInputNum(e, 0)
+                gifCellWidthFun(parseFloat(e.target.value))
+                
+            })
+            $("#gifCellWidth").on('change',(e)=>{
+                strictInputNum(e, 0, 1)
+                gifCellWidthFun(parseFloat(e.target.value))
+                var cellXcount = $("#gifXCount").val();
+                var cellXcountInt = Math.round(cellXcount)
+                if(cellXcountInt != cellXcount){
+                    $("#gifXCount").val(cellXcountInt)
+                    gifXCountFun(cellXcountInt)
+                    changeAnimation()
+                }
+                restartAnimation()
+            }) 
+            
+            
+            let gifCellHeightFun = function(value){
+                var gifCellHeight = parseFloat(e.target.value);
+                var gifImgHeight = parseFloat($("#gifImgHeight").text())
+                var cellYcount = toPrecision(gifImgHeight / gifCellHeight,2);
+                $("#gifYCount").val(cellYcount) 
+                
+            } 
+            $("#gifCellHeight").on('input',(e)=>{
+                strictInputNum(e, 0)
+                gifCellHeightFun(parseFloat(e.target.value))
+                
+            })
+            $("#gifCellHeight").on('change',(e)=>{
+                strictInputNum(e, 0, 1)
+                gifCellHeightFun(parseFloat(e.target.value))
+                var cellYcount = $("#gifYCount").val();
+                var cellYcountInt = Math.round(cellYcount)
+                if(cellYcountInt != cellYcount){
+                    $("#gifYCount").val(cellYcountInt)
+                    gifYCountFun(cellYcountInt)
+                    changeAnimation()
+                }  
+                restartAnimation()        
+            })
+             
+            $("#voidCount").on('change',(e)=>{
+                strictInputNum(e, 0);
+                EditOverlay.editPlane.animateInfo.voidCount = parseInt(e.target.value)
+                changeFrameCount()
+                changeAnimation()
+            }) 
+             
+             
+             
+            let gifDurationFun = function(value){
+                var a = EditOverlay.editPlane.animateInfo 
+                let frameCount = a.cellXcount * a.cellYcount
+                a.duration = value
+                $("#gifFps").val(toPrecision(frameCount / a.duration * 1000, 1))
+            } 
+            $("#gifDuration").on('input',(e)=>{
+                strictInputNum(e, 1);
+                gifDurationFun(parseFloat(e.target.value) * 1000)
+            })
+            $("#gifDuration").on('change',(e)=>{
+                strictInputNum(e, 1, 0.01);
+                gifDurationFun(parseFloat(e.target.value) * 1000)
+                restartAnimation()
+            })
+            
+            var gifFpsFun = function(e){
+                strictInputNum(e, 0, 1);
+                var fps = parseFloat(e.target.value)
+                var a = EditOverlay.editPlane.animateInfo 
+                let frameCount = a.cellXcount * a.cellYcount - (a.voidCount||0)
+                a.duration = frameCount / fps * 1000
+                $("#gifDuration").val(toPrecision(a.duration / 1000, 2))
+            }
+            $("#gifFps").on('input',(e)=>{
+                gifFpsFun(e)
+                
+            })
+            $("#gifFps").on('change',(e)=>{
+                gifFpsFun(e)
+                restartAnimation()
+            })
+        }
         
         
     },
@@ -3482,7 +3743,9 @@ var EditOverlay = {
     switchEditType : function(type){
         this.editType = type;
         $('#overlayUpload [name="upload"] button').text(type == 'video' ? "上传视频" : "上传图片")  
-        $('#overlayUpload .preview span').text(type == 'video' ? "支持MP4、MOV等,<20M" : "支持jpg、png等,<20M");
+        $('#overlayUpload .preview span').eq(0).text(type == 'video' ? "支持MP4、MOV等,<20M" : "支持jpg、png等,<20M");
+        if(type != 'photo' || !this.editPlane) $('#overlayProp #gifEdit').css({display: 'none'})
+         
     },
     beginToAddPlane: function(event) {
         this.switchEditType($(event.target).attr("data-type"))   
@@ -3547,26 +3810,18 @@ var EditOverlay = {
         });
         $('#overlayUpload .preview [attr-type="width"]').text(toPrecision(overlay.width, 2))
         $('#overlayUpload .preview [attr-type="height"]').text(toPrecision(overlay.height, 2))
-
-    },
-    updateOverlayPanel: function(overlay) {
-        this.editPlane = overlay;
-        overlay.requestDownload()
-        
-        if(overlay._loadDones){
-            $('.waiting').addClass('showloading');
-            overlay._loadDones.push(()=>{
-                $('.waiting').removeClass('showloading');
-            })
-        }
-        
         
         
+        $("#gifSwitch input").prop('checked', !!overlay.animateInfo);
+        $("#gifInfoEdit").css({display: !!overlay.animateInfo ? 'block' : 'none'})
+    
+    },
+    
+    updateOverlayPreview : function(overlay){
         var plane = overlay.plane
         var src = plane.material.map && (plane.material.map.image ? plane.material.map.image.src : overlay.fileSrc );
         $('#overlayUpload .preview video').remove();
         
-        overlay.overlayType && this.switchEditType(overlay.overlayType)
         
         
         if (overlay.overlayType == "video") {
@@ -3576,7 +3831,7 @@ var EditOverlay = {
         } else if(overlay.overlayType == "photo" || overlay.overlayType == "text"){
             $('#overlayUpload .preview').css({
                 'background-image': src ? ("url(" + src + ")") : "",
-                'background-size': "contain"
+                'background-size': "100% 100%"
             })
         }else{
             $('#overlayUpload .preview').css({ 
@@ -3593,9 +3848,15 @@ var EditOverlay = {
             $('#overlayUpload [name="useImgRatio"]').addClass("hide")
             $('#overlayUpload .preview').removeClass('uploaded')
         }
-
-        this.updateOverlayScaleDisplay()
-
+    }
+    ,
+    updateOverlayPanel: function(overlay) {//开始编辑时更新
+        
+        overlay.overlayType && this.switchEditType(overlay.overlayType)
+        this.updateOverlayPreview(overlay) 
+        this.updateOverlayScaleDisplay() 
+        this.updateGifPanel(overlay)
+        
         if (overlay.hasBox) {
             this.scroller.videoDepth.setValue(overlay.scale.z * settings.overlay.depth * 100, true)
         } else {
@@ -3609,12 +3870,63 @@ var EditOverlay = {
         
         this.updatePano()
     },
-    
+     
     //----------------------------
-    
-    
-    
-    
+    updateGifPanel : function(overlay){ 
+        if(this.editType == 'photo'){
+            if(!overlay.plane.material.map)return;
+            $('#overlayProp #gifEdit').css({display: 'block'})
+         
+            let w = overlay.plane.material.map.image.width
+            let h = overlay.plane.material.map.image.height
+            if(overlay.animateInfo){
+                let a = overlay.animateInfo
+                $("#gifXCount").val(a.cellXcount);
+                $("#gifYCount").val(a.cellYcount);
+                $("#gifImgWidth").text(w)
+                $("#gifImgHeight").text(h)
+                $("#gifCellWidth").val(toPrecision(w / a.cellXcount, 2));
+                $("#gifCellHeight").val(toPrecision(h / a.cellYcount, 2));
+                $("#voidCount").val(a.voidCount || 0); 
+                let frameCount = a.cellXcount * a.cellYcount - (a.voidCount || 0)
+                $("#gifFrameCount").text(frameCount) 
+                $("#gifDuration").val(toPrecision(a.duration / 1000, 2));
+                $("#gifFps").val(toPrecision(frameCount / a.duration * 1000, 1) );  
+            }else{
+                $("#gifXCount").val(1);
+                $("#gifYCount").val(1);
+                $("#gifImgWidth").text(w)
+                $("#gifImgHeight").text(h) 
+                $("#gifCellWidth").val(w);
+                $("#gifCellHeight").val(h) 
+                $("#voidCount").val(0);
+                $("#gifFrameCount").text(1) 
+                $("#gifDuration").val(1);
+                $("#gifFps").val(1);  
+                
+            }
+        }
+    }
+                    
+    ,
+    beginEdit :  function(overlay){
+        $('#overlayProp').removeClass('atRight').removeClass('hide')
+        this.endAddPlane();
+        this.editPlane = overlay;
+        
+        
+        overlay.requestDownload() 
+        if(overlay._loadDones){
+            $('.waiting').addClass('showloading');
+            overlay._loadDones.push(()=>{
+                $('.waiting').removeClass('showloading');
+            })
+        }
+        overlay.visible = true
+        this.updateOverlayPanel(overlay)  
+        transformControls.attach(overlay)      
+    }
+    ,
     panoPosSwitchOnChange : function(){
         var on = this.panoPosSwitch.is(':checked')
          
@@ -3694,7 +4006,7 @@ var EditOverlay = {
         if (type == 'cancel') {
             if (!this.editPlane.isNew && !this.editPlane.needDelete)
                 this.editPlane.setFromInfo(this.editPlane.info)
-                //this.setOverlayFromInfo(this.editPlane, this.editPlane.info);//恢复
+                
             else
                 this.disposeOverlay(this.editPlane);
             //删除	
@@ -3740,7 +4052,8 @@ var EditOverlay = {
         
         this.updateScale()
         
-        this.updateOverlayPanel(this.editPlane)
+        //this.updateOverlayPanel(this.editPlane)
+        this.updateOverlayPreview(this.editPlane)
     },
      
     getOverlayInfo: function(overlay) {
@@ -3768,6 +4081,11 @@ var EditOverlay = {
             hasBox: overlay.hasBox,
             transformAtPanos:  transformAtPanos
         }
+        
+        if(overlay.animateInfo ){
+            overlay.info.animateInfo = CloneObject(overlay.animateInfo)  
+        }
+        
     },
 
     getSavingInfo: function(overlay) {
@@ -3794,9 +4112,14 @@ var EditOverlay = {
             hasBox: overlay.hasBox ? 1 : 0,
             media: [overlay.overlayType], 
             file: overlay.fileSrc || overlay.plane.material.map.image.src,
-            transformAtPanos : transformAtPanos
+            transformAtPanos : transformAtPanos,
+            
         }
-
+        if(overlay.animateInfo && overlay.animateInfo.cellXcount * overlay.animateInfo.cellYcount > 1){
+            info.animateInfo = overlay.animateInfo    
+        }
+        
+            
         return info
 
     },
@@ -3848,7 +4171,9 @@ var EditOverlay = {
         plane.material.dispose();
         overlay.parent.remove(overlay);
         this.removeFromList(overlay)
-
+        if(this.animation){
+            GifTexDeal.remove(this.animation)
+        }
         //this.beginToAddPlane()
 
     },
@@ -3890,7 +4215,8 @@ var VisiSet = {
 
     setPanoVisible: false,
     setTagVisible: false,
-
+    setPanoLog:false,
+    
     panoVLines: {},
     //线条
     panoVTemp: {},
@@ -3912,8 +4238,11 @@ var VisiSet = {
         green: "#00c8ae"
     },
     init: function() {
+        this.footIconSizeRatio =  Math.max(player.model.size.x, player.model.size.z)  / 30; 
+        
         this.meshGroup = new THREE.Object3D;
         this.meshGroup.name = "setVisible-group"
+        
         player.model.add(this.meshGroup)
         $("#hotVisible").on("click", ()=>{
             VisiSet.enterSet(VisiSet.beginSetTagVisible.bind(VisiSet))
@@ -3982,7 +4311,7 @@ var VisiSet = {
         
     
         
-        
+       
     },
     enterSet: function(fun) {
         var enter = function() {
@@ -4002,6 +4331,83 @@ var VisiSet = {
             enter()
 
     },
+    
+    beginSetPanoLog: function() {
+        player.flying || $(".toolLeft").removeClass("unable")
+        if (this.setPanoLog)
+            return; 
+        this.setPanoLog = true
+        this.panosSelect = []
+        this.updateFootIconSize()
+        this.showFootIcons(null, true);
+        
+        for(let i in player.model.hots){
+            player.model.hots[i].visi_ = player.model.hots[i].mesh.visible;
+            player.model.hots[i].mesh.visible = false
+        } 
+        
+        
+        player.model.panos.forEach(e=>{
+            e.addTextSprite(e.id, $('#panoIdColorTex').val(), e.footIcon)
+        })
+    },
+    
+    finishSetPanoLog: function() {
+        //结束 退出这个设置
+        if (!this.setPanoLog)
+            return;
+        //否则会加多个侦听 
+        this.setPanoLog = false;
+
+        this.hideFootIcons();
+    
+        this.recoverAllState2(); 
+        this.panosSelect = null
+        player.flyoutType = null
+        
+        permitTranMode(true)
+        
+        
+        for(let i in player.model.hots){ 
+            player.model.hots[i].mesh.visible = player.model.hots[i].visi_
+        } 
+
+        $("#panosIdShow").val('')
+        
+        player.model.panos.forEach(e=>{
+            e.removeTextSprite()
+        })
+        
+        
+        
+    },
+    dealPanoLogClick: function(object) {
+        var id = object.name == '' ? object.parent.name : object.name 
+       
+        var panos = player.model.panos; 
+        
+        var index = this.panosSelect.indexOf(id)
+        if (index==-1) { 
+            this.changeFIconState(panos.index[id].footIcon, "linked" )
+            this.panosSelect.push(id)
+        }else{
+            this.changeFIconState(panos.index[id].footIcon,  false)
+            this.panosSelect.splice(index,1)
+        }
+        
+        
+        $("#panosIdShow").val('"'+this.panosSelect.join('","')+'"');         
+        
+    }
+    ,
+    changePanoIdColor:function(color){ 
+        player.model.panos.forEach(e=>{
+            e.removeTextSprite();
+            e.addTextSprite(e.id,color, e.footIcon)
+        })  
+    }
+    ,
+    //--------------
     beginSetPanoVisible: function() {
         player.flying || $(".toolLeft").removeClass("unable")
         if (this.setPanoVisible)
@@ -4433,7 +4839,7 @@ var VisiSet = {
                 }
                 
                 
-                /* if(window.routeArray){
+                /* if(window.routeArray){//箭头路线
                     if(this.panoVLines[id].visible)window.routeArray.push(id)
                     else{
                         let index = window.routeArray.indexOf(id)
@@ -4601,8 +5007,8 @@ var VisiSet = {
         //根据相机位置 改变footIcon大小,使在范围内看到的热点大小一致,防止太小点击不到
         if (!this.footIcons)
             return;
-        var s = player.cameraControls.controls.floorplan.absoluteScale * 2.8;
-        s = THREE.Math.clamp(s, 0.5, 1.4);
+        var s = player.cameraControls.controls.floorplan.absoluteScale *  2.8
+        s = THREE.Math.clamp(s, 0.5 * this.footIconSizeRatio, 1.4 * this.footIconSizeRatio);
         this.footIcons.forEach(function(f) {
             try {
 
@@ -4800,32 +5206,22 @@ var VisiSet = {
 
 }
 
+
+
+ 
+
+
+
+
+
+
+
+
 function permitTranMode(state) {
     state ? $(".pinBottom.left").removeClass('hide') : $(".pinBottom.left").addClass('hide');
 }
 
-CloneObject = function(copyObj, result, isSimpleCopy) {
-    //isSimpleCopy只复制最外层
-    //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
-    result = result || {};
-    if (copyObj instanceof Array) {
-        if (copyObj[0]instanceof Object) {
-            //不支持含有 [[Object]] 这样二级数组里面还是复杂数据的,普通和复杂的数据混合可能也不支持
-            console.error("不支持含有 [[Object]] 这样二级数组里面还是复杂数据的...")
-        }
-        return copyObj.slice(0);
-        //如果是数组,直接复制返回(排除数组内是object
-    }
-    for (var key in copyObj) {
-        if (copyObj[key]instanceof Object && !isSimpleCopy)
-            result[key] = CloneObject(copyObj[key]);
-        else
-            result[key] = copyObj[key];
-        //如果是函数类同基本数据,即复制引用
-    }
-    return result;
-}
-;
+
 
 function randomWord(randomFlag, min, max) {
     //随机字符串

Plik diff jest za duży
+ 1307 - 0
js/lib/OBJLoader.js


Plik diff jest za duży
+ 0 - 59689
js/mainEdit.js


Plik diff jest za duży
+ 0 - 54405
js/main_2018.js


Plik diff jest za duży
+ 0 - 55949
js/main_2018_edit.js


Plik diff jest za duży
+ 0 - 55691
js/main_2019.js


Plik diff jest za duży
+ 81 - 44
js/main_2020_edit.js


+ 183 - 59
js/main_2020_show.js

@@ -1,7 +1,8 @@
 /* 许钟文修改的  标记 xzw    
 另外 	所有"matter"字样已被我删除				原因:删除matterport信息
   */
-  
+ 
+
 window.common = null;  
 window.MathLight = null;
 window.math = null
@@ -9,7 +10,7 @@ window.easing = null
 window.lerp = null
 window.transitions = null
 window.browser = null
-window.momentTourBlackNewType = 0//true
+window.momentTourBlackNewType =  number == 'TEST'//true
 
 g_playAudio = null
 
@@ -67,7 +68,7 @@ var getTransformSid = function(){
  
 
 
-
+/* 
 var addMagnifier = function(){ 
 
     class Magnifier extends THREE.Object3D {
@@ -150,7 +151,7 @@ var addMagnifier = function(){
 
     new Magnifier() 
 }
- 
+  */
  
 var convertTool = { 
 	getPos2d : function(point, camera, dom){//获取一个三维坐标对应屏幕中的二维坐标
@@ -5036,6 +5037,10 @@ window.Modernizr = function(n, e, t) {
                         g_tourAudio.load()  
                     }
                     
+                    if(g_bgAudio && !g_bgAudio.paused){
+                        manage.switchBgmState(false); 
+                        g_bgAudio.pauseByTour = true
+                    }
                 }
                 //}
                 if (this.onTheBus = !0,
@@ -14663,6 +14668,7 @@ window.Modernizr = function(n, e, t) {
 			progressUpdate(0.1)
 			var fileName = g_version ?  'modeldata.js' : 'someData.json' ;
             $.ajax(g_Prefix + "data/"+window.number+"/"+fileName+"?"+randomTime().getTime(),{dataType: "json"}).done( function(e){ //改
+                 
                 var data = matcher(e);
 				data.files.templates[0] = g_Prefix + e.files.templates[0].replace("{{number}}",window.number);
 				data.user = {
@@ -14706,8 +14712,15 @@ window.Modernizr = function(n, e, t) {
                         $(this).remove()
                     })
                 }
-
-                
+                //背景
+                settings.transparentBg = settings.transparentBg || data.transparentBg || false,
+                settings.bgImg = settings.bgImg || data.bgImg || null
+                if(settings.bgImg){
+                    $("#player").css({'background-image': "url("+settings.bgImg+")",
+                        "background-position": "center center" 
+                    })
+                    
+                }
             })
 			
 			function StartLoad(){//当加载完data后
@@ -14929,9 +14942,7 @@ window.Modernizr = function(n, e, t) {
 					t.layers.enable(he.TAG);
 					var i = new x.Scene
 					  , n = new x.AmbientLight(16777215);
-					i.add(n),
-					i.skybox = new W,
-					i.add(i.skybox),
+					i.add(n), 
 					i.plane = new x.Mesh(new x.PlaneBufferGeometry(1e5,1e5),new x.RawShaderMaterial({
 						side: x.DoubleSide
 					})),
@@ -14954,7 +14965,16 @@ window.Modernizr = function(n, e, t) {
 					V.showAxis && (i.add(new x.ArrowHelper(new x.Vector3(0,1,0),new x.Vector3(0,0,0),1,255)),
 					i.add(new x.ArrowHelper(new x.Vector3(0,0,1),new x.Vector3(0,0,0),1,16711680)),
 					i.add(new x.ArrowHelper(new x.Vector3(1,0,0),new x.Vector3(0,0,0),1,65280)));
-					var r = new te(i,t,z);
+                    
+                    //背景
+                    if(!settings.transparentBg && !settings.bgImg){
+                        i.skybox = new W 
+                        i.add(i.skybox) 
+                    }
+                    
+                    
+                    
+					var r = new te(i,t,z); 
 					return r
 				}
 				function y(e, t) {
@@ -15899,7 +15919,7 @@ window.Modernizr = function(n, e, t) {
             }else{
                 u.texture1.value = defaultTex1;
                 u.texture2.value = defaultTex2;
-                console.log(this.sid)
+             
             }  
         }
         
@@ -15922,13 +15942,39 @@ window.Modernizr = function(n, e, t) {
         }
         hot.prototype.setVisiblePanos = function(visibleData){ 
             this.visiblePanos = []; 
-            this.model.panos.list.forEach((pano)=>{// 模型遮挡的, 直接不可见
-                if(visibleData && !visibleData.includes(pano.id))return; //在热点可视中设置过,不可见
-                var isShelter = convertTool.ifIntersectChunks(pano.position, this.position, {model: this.model.colliders});
-                if(!isShelter){
-                    this.visiblePanos.push(pano.id)
-                }
-            })
+            
+            let maxCount = browser.isMobile() ? 4000 : 10000 
+            let c = this.model.panos.list.length * this.model.colliders.length
+            if(c < maxCount){
+                this.model.panos.list.forEach((pano)=>{// 模型遮挡的, 直接不可见
+                    if(visibleData && !visibleData.includes(pano.id))return; //在热点可视中设置过,不可见
+                    var isShelter = convertTool.ifIntersectChunks(pano.position, this.position, {model: this.model.colliders});
+                    if(!isShelter){
+                        this.visiblePanos.push(pano.id)
+                    }
+                }) 
+            }else{//防止加载时间过长,分批计算
+                let c1 = Math.ceil(maxCount / this.model.colliders.length)
+                let start = 0
+                let interval = setInterval(()=>{
+                    let end = start + c1; 
+                    end = Math.min(end, this.model.panos.list.length)
+                    let i = start
+                    start = end
+                    for(;i<end; i++){ 
+                        var pano = this.model.panos.list[i]
+                        if(visibleData && !visibleData.includes(pano.id))return; //在热点可视中设置过,不可见
+                        var isShelter = convertTool.ifIntersectChunks(pano.position, this.position, {model: this.model.colliders});
+                        if(!isShelter){
+                            this.visiblePanos.push(pano.id)
+                        }
+                    } 
+                    if(end>=this.model.panos.list.length){
+                        console.log(window.hotsi ?(++window.hotsi): (window.hotsi = 1))
+                        clearInterval(interval)
+                    }
+                },20 ) 
+            }
         }
         
 		 //绘制热点
@@ -17857,12 +17903,15 @@ window.Modernizr = function(n, e, t) {
             n.parseRoomIndexFromWorkshopRoomId = function(e) {
                 var t = -1;
                 if (e) {
-                    var i = e.split("_");
-                    t = parseInt(i[0])
+                    if(typeof e == 'number'){//add
+                        t = parseInt(e)
+                    }else{
+                        var i =  e.split("_");
+                        t = parseInt(i[0])
+                    }
                 }
                 return t
-            }
-            ,
+            },
             t.exports = n
         }
         ).call(this, "/js/model/LabelCollection.js")
@@ -18473,9 +18522,31 @@ window.Modernizr = function(n, e, t) {
                 for (var t in this.tags)
                     this.tags[t].build();
                 
-                //add-----
-                for(let i in this.hots){
-                    this.hots[i].setVisiblePanos(this.hots[i].visibleData);
+                //add----- 
+                { 
+                    let maxCount = browser.isMobile() ? 4000 : 10000
+                    
+                    let c = this.panos.list.length * this.colliders.length
+                    if(c < maxCount){
+                        for(let i in this.hots){
+                            this.hots[i].setVisiblePanos(this.hots[i].visibleData);
+                        }
+                    }else{//防止加载时间过长,分批计算
+                        console.log('hot分批setVisiblePanos')
+                        let hotsId = Object.keys(this.hots)
+                        if(hotsId.length){
+                            let i = 0
+                            let hotVisiInterval = setInterval(()=>{
+                                this.hots[hotsId[i]].setVisiblePanos(this.hots[hotsId[i]].visibleData);
+                                i++;
+                                if(i>=hotsId.length){
+                                    clearInterval(hotVisiInterval)
+                                }
+                            }, Math.round( browser.isMobile() ? c/200 : c/500)) 
+                        }
+                    } 
+
+                    
                 }
                 //---------   
                 
@@ -18625,7 +18696,7 @@ window.Modernizr = function(n, e, t) {
                 var e = $.Deferred();
                 //加载俯视图的标签  注释这个备注就会加载
                 //原先是labels, 改为showLabels,因为之前的somedata写的labels都是true
-                window.MP_PREFETCHED_MODELDATA.model.player_options.showLabels ? this.showingLabels = true : '';
+                window.MP_PREFETCHED_MODELDATA.showingLabels ? this.showingLabels = true : '';
                 if (!this.showingLabels)  
                     return e.resolve(); 
                 // var t = this.options.urlBase + "/api/v1/jsonstore/model/labels/" + this.sid;
@@ -22161,7 +22232,7 @@ window.Modernizr = function(n, e, t) {
                 this.emit(w.ModeChanged, e, t)
             }
             ,
-            n.prototype.isWarping = function() {
+            n.prototype.isWarping = function() {//是否导览缓慢走向某个点
                 return this.path.warping
             }
             ,
@@ -22387,13 +22458,7 @@ window.Modernizr = function(n, e, t) {
                 if (this.mouseCouldBeClickToMove) {
                     //window.DownInterface && new DownInterface().state(this,Hot);
                     window.Hotpoint && new Hotpoint().state(this,Hot);
-                }
-               
-                /* this.overlayGroup.children.forEach((overlay)=>{
-                    overlay.overlayType == "video" && overlay.visible && overlay.inSight() && overlay.videoControl(true)
-                }) */
-                 
-                
+                } 
             }
             ,
 			
@@ -22546,7 +22611,7 @@ window.Modernizr = function(n, e, t) {
                 //add
                 this.transitionPos({type:"beforeFlytopano", pano:this.currentPano, dur:0})
                 this.updateHotVisible()
-                
+                Overlay.updateVisibles([this.currentPano])
                 
                 return this.mode = u.PANORAMA,
                 e.floor.enter(this.mode),
@@ -22736,13 +22801,7 @@ window.Modernizr = function(n, e, t) {
                             this.model.hots[i].update(this.camera)
                         } 
                         if(this.mode == 'panorama')this.overlayGroup.children.forEach(overlay=>{
-                            if(overlay.overlayType == "video"){
-                                if(overlay.visible && overlay.inSight()){
-                                    overlay.videoControl(true) 
-                                }else{
-                                    overlay.videoControl(false) 
-                                }
-                            }
+                            overlay.update()
                         })
                         
                     }
@@ -23081,11 +23140,20 @@ window.Modernizr = function(n, e, t) {
                 if(this.openOverlay && !overlay)return;
                 var plane = overlay.plane;
                 
-                if(overlay.overlayType == "video"){
+                /* if(overlay.overlayType == "video"){
                     if(plane.material.map.image.paused) plane.material.map.image.play()
                     else plane.material.map.image.pause()
+                } */
+                
+                
+                if(overlay.overlayType == "video"){
+                    overlay.switchPlay(!!overlay.pausedByUser)
+                    
                 }
                 
+                
+                
+                
                /*  if(window.EditOverlay &&EditOverlay.editing){
                     if(EditOverlay.editPlane && overlay != EditOverlay.editPlane) EditOverlay.closeOverlayPanel('cancel')
                     
@@ -23481,8 +23549,44 @@ window.Modernizr = function(n, e, t) {
                 }
             }
             ,
-            
-            
+            n.prototype.warpToPano = function(o={}) {
+                
+            }
+            n.prototype.blackToPano = function(o={}) {//add 瞬间过渡
+                o.panoId = "8bc9156b288d48459e4e0f74d7051ef1"
+                let oldPos = this.position.clone();
+                let oldPano = this.currentPano
+                let pano = o.pano || this.model.panos.index[o.panoId] 
+                 
+
+                this.path.warpDestPano = pano
+ 
+                var retry = ()=>{
+                    this.waitingToWarp = !1,
+                    this.blackToPano(o)
+                }
+                if (this.checkAndWaitForPanoLoad(pano, "high", "low", this.basePanoSize, retry))
+                    return void (this.waitingToWarp = !0)
+                 
+                this.emit("pano.chosen", oldPano, pano),
+
+ 
+                this.path.warpDestHeroLoc = {  
+                    panoId : o.panoId,
+                    position: pano.position,
+                    quaternion: o.quaternion || this.quaternion.clone()
+                   
+                }
+                
+                
+                this.path.warpTravel_BLACK(null, 1500,1, ()=>{ 
+                    pano != this.currentPano && this.currentPano.exit() 
+                    pano.enter() 
+                    this.currentPano = pano
+                    this.emit("flying.ended", pano.position, oldPos, pano, oldPano) 
+                } )
+                
+            }
             
             window._transitionPosId = 9999
             
@@ -24018,8 +24122,13 @@ window.Modernizr = function(n, e, t) {
                     
                     if(this.mode == u.PANORAMA){ 
                         Overlay.updateVisibles([this.currentPano])
-                    }else{
+                    }else{ 
                         Overlay.updateVisibles(true)
+                        this.overlayGroup.children.forEach(overlay=>{
+                            if(overlay.animateInfo){ 
+                                GifTexDeal.start(overlay.animation)
+                            }
+                        })
                     }
                     
                     h && p !== u.PANORAMA && i === u.PANORAMA ? this.startWarp(b.Retain, E.Retain, x.BLACK, null, null, s) : (s && s(),
@@ -24761,11 +24870,14 @@ window.Modernizr = function(n, e, t) {
         }
         ,
         n.prototype.createContext = function(e) {
+            var transparent = !!(settings.transparentBg || settings.bgImg)
             try {
-                this.renderer = new r.WebGLRenderer({antialias: !m.isMobile()}),
+                this.renderer = new r.WebGLRenderer({antialias: !m.isMobile(), alpha:transparent}),
                 this.renderer.autoClear = !0,
                 this.renderer.setPixelRatio(window.devicePixelRatio ? window.devicePixelRatio : 1),
                 this.renderer.setSize($("#player").width(), $("#player").height(), false),  //改
+                
+                transparent && this.renderer.setClearColor( 0x000000, 0 ); //透明
                 this.emit(a.ContextCreated)
             } catch (e) {
                 throw new h("Unable to create a WebGL rendering context")
@@ -28887,7 +28999,10 @@ window.Modernizr = function(n, e, t) {
                       , c = this.highSize
                       , h = this.ultraHighSize;
                     this.queueTilesForPano(r, a, this.priorityCriteria.pano, s),
+                    
                     this.priorityCriteria.upcomingPanos && this.queueTilesForPanos(r, this.priorityCriteria.upcomingPanos, a, s, n.MAX_UPCOMING_PANOS_TOADD),
+                    this.priorityCriteria.upcomingPanos && this.queueTilesForPanos(r, this.priorityCriteria.upcomingPanos, a, 1024  , n.MAX_UPCOMING_PANOS_TOADD),//更清晰些
+                    
                     i.length = 0,
                     this.canDownloadSize(l) && this.queueTilesInDirectionForPano(i, a, this.priorityCriteria.pano, l, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDir, n.DIRECTIONAL_FOV_NARROW),
                     n.sortPanoTiles(i, this.priorityCriteria.pano, this.priorityCriteria.cameraDir),
@@ -31121,26 +31236,34 @@ window.Modernizr = function(n, e, t) {
             }
             ,
             
-            getVisiblePano : function(position, options={}){//add
+            getVisiblePano : function(positions = [], options={}){//add
                 var visiblePanos = []; 
-                var B = position.clone(); 
+               
                 var panos = options.panos ||  player.model.panos.list;
-                 
+                options.posAtPanos = options.posAtPanos  || {}//在不同漫游点的positions
                 panos.forEach((pano)=>{
                     if(!pano.isAligned())return;
                     var A = pano.position.clone();
-                      
-                    var ray = new THREE.Raycaster(A.clone(), B.clone().sub(A).normalize(), 0, A.distanceTo(B) - (options.tolerance||0) ) 
-                    var o = ray.intersectObjects(options.model || player.model.colliders, true);
-                     
-                     
-                    if (!o || !o.length)visiblePanos.push(pano );
-                     
+                    var posB = options.posAtPanos[pano.id] || positions;
+                    var posLength = posB.length
+                    
+                    for(let i=0;i<posLength;i++){
+                        
+                        var B = posB[i];
+                        var ray = new THREE.Raycaster(A.clone(), B.clone().sub(A).normalize(), 0, A.distanceTo(B) - (options.tolerance||0) ) 
+                        var o = ray.intersectObjects(options.model || player.model.colliders, true);
                     
+                        if (!o || !o.length){ //只要有一点可见,就算整体可见
+                            visiblePanos.push(pano );
+                            break;
+                        }
+                    }    
+                     
                 })  	  
              
                 return visiblePanos
             } 
+            
             ,
             sortByScore : function(list, request, rank) {
                 var i = this.filterAll(list, request);
@@ -58738,8 +58861,9 @@ function initTransitionPass(THREE){
                         
                         const float maxRadius = 0.708;      // sqrt(0.5^2+0.5^2)
                         const float minRadius = 0.0 ;
-                        float radius = sqrt((vUv.x - 0.5)*(vUv.x - 0.5) + (vUv.y - 0.5)*(vUv.y - 0.5)/screenRatio);
-                        float diff = 0.15;
+                         
+                        float radius = screenRatio>1.0 ? sqrt((vUv.x - 0.5)*(vUv.x - 0.5) + (vUv.y - 0.5)*(vUv.y - 0.5)/screenRatio) : sqrt((vUv.x - 0.5)*(vUv.x - 0.5)*screenRatio+ (vUv.y - 0.5)*(vUv.y - 0.5));
+                        float diff = 0.292;    //1.0-maxRadius;
                         float radiusIn = maxRadius * progress + minRadius * (1.0-progress);
                         float radiusOut = radiusIn + diff;
                         if(radius < radiusIn) {

+ 155 - 0
js/manage.js

@@ -467,8 +467,163 @@ function hotMatcher(data={}){
 }
 
 
+var GifTexDeal = {
+    
+    animateObjects : [], 
+     
+    addAnimation : function(texture, owner, info, id){
+        var object = {
+            texture,
+            owner,
+            info,
+            id 
+        }
+        this.setRepeart(object)
+        this.animateObjects.push(object)
+        return object
+    },
+    remove : function(object){
+        var index = this.animateObjects.indexOf(object) 
+        if(index>-1){
+            this.stop(object)
+            object.texture.repeat.set(1,1) 
+            this.animateObjects.splice(index, 1)
+        }
+    },
+    setRepeart : function(object){
+        object.texture.repeat.set(1/object.info.cellXcount, 1/object.info.cellYcount)
+    },
+    start: function(object){ 
+        /* var b = this
+          , offset = this.cursor.material.map.offset
+          , f = function(a) {
+            return Math.floor(17 * a) / 17   //对应17个精灵图片段
+        };
+        b.canStartAnimation = !1,
+        this.cursorAnimate = new TWEEN.Tween(offset).to({
+            x: 1    //100%
+        }, 1e3).onStart(function() {
+            b.canStartAnimation = !1
+        }).onStop(function() {
+            b.canStartAnimation = !0,
+            this.x = 0,
+            offset.x = 0
+        }).onUpdate(function() {}).onComplete(function() {
+            done(),
+            offset.x = 0,
+            setTimeout(function() {
+                b.canStartAnimation = !0
+            }, 1500)
+        }),
+        this.cursorAnimate.easing(f),
+        this.cursorAnimate.start()
+ */ 
+          
+        if(!object || object.started)return;
+        var count = object.info.cellXcount * object.info.cellYcount - (object.info.voidCount || 0)
+     
+        if(count <= 1 )return;
+        
+        transitions.start( (progress)=>{
+            var index = Math.floor(count * progress);
+            var indexX =  index % object.info.cellXcount
+            var indexY =  object.info.cellYcount - Math.floor(index / object.info.cellXcount ) - 1;  //uv.offset.y是从下到上的
+            object.texture.offset.x = indexX / object.info.cellXcount;
+            object.texture.offset.y = indexY / object.info.cellYcount;
+            
+            //console.log(object.id + " : "+ object.texture.offset.toArray())
+        } , object.info.duration, ()=>{//done
+            object.started = false
+            object.texture.offset.x = 0;
+            object.texture.offset.y = 0;
+            this.start(object)
+        }, 0 ,null, object.id, "gif_"+object.id); 
+
+        object.started = true
+
+    },
+    
+    startAnimations : function(o={}){
+        this.animateObjects.forEach(e=>{this.start(e)})
+
+    }
+    ,
+    stop: function(object){ 
+        if(!object || !object.started)return;
+        transitions.cancelById("gif_"+object.id);
+        object.texture.offset.set(0,0)    
+        object.started = false
+    }
+}
+
+var CloneObject = function(copyObj, result, isSimpleCopy) {
+    //isSimpleCopy只复制最外层
+    //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
+    if(!copyObj)return null
+    result = result || {};
+    if (copyObj instanceof Array) {
+        if (copyObj[0]instanceof Object) {
+            //不支持含有 [[Object]] 这样二级数组里面还是复杂数据的,普通和复杂的数据混合可能也不支持
+            console.error("不支持含有 [[Object]] 这样二级数组里面还是复杂数据的...")
+        }
+        return copyObj.slice(0);
+        //如果是数组,直接复制返回(排除数组内是object
+    }
+    for (var key in copyObj) {
+        if (copyObj[key]instanceof Object && !isSimpleCopy)
+            result[key] = CloneObject(copyObj[key]);
+        else
+            result[key] = copyObj[key];
+        //如果是函数类同基本数据,即复制引用
+    }
+    return result;
+}
+;
+
+
+
 
 
+var SoundPriority = {//暂不支持同时播放
+    currentPlay:null,//当前正在播放list中的哪一个
+    list:[
+        {
+            name:"bg", 
+            level : 0,//越大优先级越高
+            canBeInterrupted : true ,
+            
+        },
+        {
+            name:"boxVideo", 
+            level : 1, 
+            canBeInterrupted : true,
+            checkIfNeedPlay:function(){
+                
+                
+            }
+        },
+        {
+            name:"hot", 
+            level : 2, 
+            canBeInterrupted : true
+        },
+        {
+            name:"tour", 
+            level : 3, 
+            canBeInterrupted : true
+        },
+        
+        
+    ],
+    register:function(){
+        
+        
+        
+    }
+    
+    
+}
+
 //兼容一代的場景
 //請求地址統一管理
 var g_onePregix = "https://bigscene.4dage.com/" //对应一代  http://www.4dmodel.com/SuperPanoramic/index.html?m=55

+ 3 - 1
js/myShow.js

@@ -63,7 +63,9 @@ var settings = {
     overlay:{
 		width:1, height:0.5, depth:0.02
 	} ,
-    //dontExamHot:true    
+    //dontExamHot:true  
+    transparentBg: false,
+    bgImg:  null 
 }
 if(window.number == '725'||window.number == '724'){
     settings.mobileNavHigh = true

+ 132 - 21
js/overlay.js

@@ -79,9 +79,10 @@ var initOverlay = function(THREE) {
                 
                 video.oncanplaythrough = function() {
                     plane.material.map.needsUpdate = !0
-                    if(video.shouldPlay){
-                        video.play()
-                    } 
+                   
+                    video.play()
+                        
+                     
                 }
                 
                 
@@ -97,8 +98,18 @@ var initOverlay = function(THREE) {
 
                 info.type = "photo"
                 plane.material.opacity = 0.1;
-            }
+                
+                /* this.animateInfo = {
+                        cellXcount : 4,
+                        cellYcount : 2,
+                        loop : true,
+                        duration : 1000 
+                    }
+                */
 
+        
+            }
+            
             plane.material.color = new THREE.Color(1,1,1)
         }
         if (info.width == void 0)
@@ -110,6 +121,10 @@ var initOverlay = function(THREE) {
 
     }
 
+
+
+
+
     Overlay.prototype.setFromInfo = function(info) {
         //1 恢复到编辑之前 2 初始加载 
         var plane = this.plane; 
@@ -170,8 +185,11 @@ var initOverlay = function(THREE) {
                 plane.material.map.minFilter = THREE.LinearFilter;
                 plane.material.map.magFilter = THREE.LinearFilter;
                 plane.material.map.generateMipmaps = true;  */
-            } else
+            } else{
                 plane.material.map.image = info.media;
+                plane.material.map.needsUpdate = true
+            }
+                
             this.file = info.file;
         }
         this.overlayType = info.type;
@@ -182,7 +200,21 @@ var initOverlay = function(THREE) {
 
         this.updateMatrixWorld()
         this.getVisiblePanos()
-
+        
+        
+        {//gif
+            if(this.animation){
+                GifTexDeal.remove(this.animation)
+            }
+            this.animateInfo = CloneObject(info.animateInfo) 
+            if(this.animateInfo && plane.material.map){
+                this.animation = GifTexDeal.addAnimation(plane.material.map, this, this.animateInfo, this.sid )
+                this.visible && this.inSight() && GifTexDeal.start(this.animation)
+            }    
+        }
+        
+        
+        
     }
 
 
@@ -251,34 +283,86 @@ var initOverlay = function(THREE) {
 
     }
 
-    Overlay.prototype.getVisiblePanos = function() {
-        this.visiblePanos = common.getVisiblePano(this.plane.getWorldPosition(), {
-            model: null
+    Overlay.prototype.getVisiblePanos = function() {//在不同点还不一样
+        var depth = this.scale.z * settings.overlay.depth;
+        var getPos = function(position, quaternion, width, height){//每个overlay位置对应5个坐标,plane中心和四个角的位置
+            
+            var cornerPoint = [
+                new THREE.Vector3(0, 0, depth),
+                new THREE.Vector3(-width/2, height/2, depth),
+                new THREE.Vector3(width/2, height/2, depth),
+                new THREE.Vector3(width/2, -height/2, depth),
+                new THREE.Vector3(-width/2, -height/2, depth),
+            ]; 
+            
+            return cornerPoint.map(e=>{
+                return e.clone().applyQuaternion(quaternion).add(position)
+            }) 
+            
+        }
+        
+        var customPositions = getPos(this.posCustom, this.quaCustom, this.widthCustom, this.heightCustom)
+        var posAtPanos = {}
+        
+        for(let panoId in this.transformAtPanos){
+            if(panoId == 'outSide')continue;
+            posAtPanos[panoId] = getPos(this.transformAtPanos[panoId].pos, this.transformAtPanos[panoId].qua, this.transformAtPanos[panoId].width, this.transformAtPanos[panoId].height)
+            
+        }  
+        
+        
+        this.visiblePanos = common.getVisiblePano(customPositions, {
+            model: null , posAtPanos
         });
-
     }
     
     
-    Overlay.prototype.updateVisibles = function(panos) {
+    
+    Overlay.prototype.updateVisible = function(panos, visibility) {
         
         if(settings.isEdit && EditOverlay.editPlane == this){
             return true
         }
         
-        this.visible = !!panos.find(pano=>this.visiblePanos.includes(pano))
-        if (!this.visible && this.overlayType == 'video')
-            this.videoControl('stop')
+        this.visible = visibility != void 0 ? visibility : !!panos.find(pano=>this.visiblePanos.includes(pano))
+        
+        if (this.overlayType == 'video'){
+            //this.switchPlay(this.visible,  this.visible ? null : 'stop' );//可见时不操作;不可见时停止
+            this.update()
+        }
+        
+        
+            
+        
+        /* if(this.animateInfo){ //在player.update里更新
+            if(this.visible){
+                GifTexDeal.start(this.animation)
+            }else{
+                GifTexDeal.stop(this.animation)
+            }
+        } */ 
     }
     
     
     Overlay.updateVisibles = function(panos) {
         if (panos === true) {
-            player.overlayGroup.children.forEach(e=>e.visible = true)
+            player.overlayGroup.children.forEach(e=>e.updateVisible(null,true))
         } else {
-            player.overlayGroup.children.forEach(e=>e.updateVisibles(panos))
+            player.overlayGroup.children.forEach(e=>e.updateVisible(panos))
         }
     }
 
+
+    Overlay.prototype.switchPlay = function(state){//手动播放暂停 
+        this.pausedByUser = !state
+        
+        this.videoControl(state)
+       
+        
+    }
+    
+
+
     Overlay.prototype.videoControl = function(state){
         if(this.overlayType != "video")return
         var video = this.plane.material.map.image
@@ -288,14 +372,17 @@ var initOverlay = function(THREE) {
                 video.currentTime = 0;
                
             }
-            video.shouldPlay = false
+             
             //console.log("pause")
         }else if(state){ 
             video.paused && video.play()
-            video.shouldPlay = true
+             
             //console.log("play")
         }
     }     
+    
+    
+    
     Overlay.prototype.inSight = function(){
         if(player.mode == 'panorama'){
             var position = this.plane.getWorldPosition()
@@ -309,7 +396,7 @@ var initOverlay = function(THREE) {
                     new THREE.Vector3(settings.overlay.width/2, -settings.overlay.height/2, 0),
                     new THREE.Vector3(-settings.overlay.width/2, -settings.overlay.height/2, 0),
                 ];            
-                for(var i=0;i<4;i++){
+                for(var i=0;i<4;i++){//只要有一点可见就算看见
                     cornerPoint[i].applyMatrix4(this.plane.matrixWorld);
                     var pos2d = math.getPos2d(cornerPoint[i], player.camera, $("#player")[0])
                     if(pos2d.trueSide && pos2d.inSight){
@@ -317,11 +404,26 @@ var initOverlay = function(THREE) {
                     }
                 }
             }
-        }else{
+        }else{//飞出要判断模型阻挡,有点耗时就算了
             return true
         }
     }
     
+    Overlay.prototype.update = function(){//实时监测播放
+        if(this.overlayType == "video"){
+            if(this.visible && !this.pausedByUser && this.inSight()){
+                this.videoControl(true) 
+            }else{
+                this.videoControl(false) 
+            }
+        }else if(this.animateInfo){ 
+            if(this.visible && this.inSight()){
+                GifTexDeal.start(this.animation)
+            }else{
+                GifTexDeal.stop(this.animation)
+            } 
+        }
+    }
     
     Overlay.prototype.addToLoadQueue = function() {
         if (this.overlayType == 'photo') {
@@ -339,7 +441,7 @@ var initOverlay = function(THREE) {
         var plane = this.plane;
 
         plane.material.map = Texture.load(this.file, ()=>{
-            plane.material.needsUpdate = true
+            
             if (this._loadDones) {
                 this._loadDones.forEach(e=>e())
                 this._loadDones = null
@@ -347,6 +449,13 @@ var initOverlay = function(THREE) {
             setTimeout(Overlay.loadNext, 50)
             plane.material.opacity = 1;
             console.log('overlay loaded: ' + this.sid)
+            
+            if(this.animateInfo){
+                this.animation = GifTexDeal.addAnimation(plane.material.map, this, this.animateInfo, this.sid )
+                this.visible && this.inSight() && GifTexDeal.start(this.animation)
+            }
+            
+            plane.material.needsUpdate = true
         })
         plane.material.map.wrapS = plane.material.map.wrapT = THREE.ClampToEdgeWrapping;
         plane.material.map.minFilter = THREE.LinearFilter;
@@ -437,3 +546,5 @@ var initOverlay = function(THREE) {
     window.Overlay = Overlay;
 
 }
+
+