Bladeren bron

fix: hotScale adjust

xzw 3 jaren geleden
bovenliggende
commit
c727545df8
3 gewijzigde bestanden met toevoegingen van 52 en 17 verwijderingen
  1. 11 5
      edit.html
  2. 7 3
      js/Hot.js
  3. 34 9
      js/edit.js

+ 11 - 5
edit.html

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

+ 7 - 3
js/Hot.js

@@ -28,7 +28,11 @@ window.initHot = function(model){
         opacity: 0.8,
         side:THREE.DoubleSide
     })
-    var autoSizeInfo = {minSize : 120,  maxSize : 600,   nearBound : 1 , farBound :  15}
+     
+    var autoSizeInfo = /* {width2d:50}// */{minSize : 120,  maxSize : 600,   nearBound : 1 , farBound :  15}
+
+
+
 
     var hotGroup = new THREE.Object3D;  hotGroup.name = "hotGroup"
     model.add(hotGroup);   model.hotGroup = hotGroup
@@ -130,7 +134,7 @@ window.initHot = function(model){
              
             
             this.sid = info.sid;
-            this.preDeal(info, source)// source:来源
+            this.preDeal(info, source)// source:旧版来源
             
             this.info = info
             this.cornerPoints = []
@@ -532,7 +536,7 @@ window.initHot = function(model){
                     info.rotation = new THREE.Euler().setFromVector3(convertValue(info.rotation, THREE.Vector3 ))  //热点的旧数据很多是字符串 
                 }
                  
-                var s = Hot.getDefaulScale(info.hotIconScale)
+                var s = Hot.getDefaulScale(info.hotIconScale) //旧版的大小,统一转换成新版
                 info.scale = new THREE.Vector3(s,s,0.02)    
                
               

+ 34 - 9
js/edit.js

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