瀏覽代碼

临时保存

gemercheung 2 年之前
父節點
當前提交
6544b10b0d

+ 31 - 52
packages/qjkankan-editor/public/static/template/customTooltip.xml

@@ -1,10 +1,10 @@
 <krpano>
-
-    <action name="addImgTextHotSpot">
+    <!-- 1.20. 新热点模式 -->
+    <action name="addJQHotspot">
         showlog();
         set(schp_name,%2); 
         set(hotspot[get(schp_name)].type,'text');
-                                                <!-- set(hotspot[get(schp_name)].url,%1); -->
+        <!-- set(hotspot[get(schp_name)].url,%1); -->
         set(hotspot[get(schp_name)].ath,%4);
         set(hotspot[get(schp_name)].atv,%5);
         set(hotspot[get(schp_name)].hotspottitle,%3);
@@ -14,19 +14,19 @@
         set(hotspot[get(schp_name)].scale,1);
         set(hotspot[get(schp_name)].autoalpha,false);
         set(hotspot[get(schp_name)].distorted,false);
-                                                <!-- set(hotspot[get(schp_name)].width,'prop');
+         <!-- set(hotspot[get(schp_name)].width,'prop');
         set(hotspot[get(schp_name)].height,%11); -->
         set(hotspot[get(schp_name)].width, 1); 
         set(hotspot[get(schp_name)].height,70); 
         set(hotspot[get(schp_name)].visible,true);
-                                                <!-- set(hotspot[get(schp_name)].onhover,showtext(get(hotspottitle),skintext));  -->
+        <!-- set(hotspot[get(schp_name)].onhover,showtext(get(hotspottitle),skintext));  -->
         addhotspot(get(schp_name));
         set(hotspot[get(schp_name)].onclick,'js(__krfn.utils.linkopen(%8,%2));');
   
         if(%7 == false,
           , 
           set(hotspot[get(schp_name)].ondown,draghotspot1(););
-          set(hotspot[get(schp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv),"imgtext")));
+          <!-- set(hotspot[get(schp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv),"imgtext"))); -->
         );
 
                                                 <!-- txtadd(hotspot[get(schp_name)].onloaded,"add_all_the_time_tooltip(hotspot[get(name)].hotspottitle);"); -->
@@ -48,7 +48,6 @@
   
     </action>
 
-
     <action name="add_all_2_tooltip">
         txtadd(tooltipname2, 'tooltip2_', get(name)); 
         set(toolP,get(name)); 
@@ -58,7 +57,7 @@
         set(layer[get(tooltipname2)].autowidth, true);
         set(layer[get(tooltipname2)].width,'prop');
         set(layer[get(tooltipname2)].height,30); 
-        set(layer[get(tooltipname2)].edge,ce);
+        set(layer[get(tooltipname2)].edge,center);
         set(layer[get(tooltipname2)].background,false);
         set(layer[get(tooltipname2)].x,0);
         set(layer[get(tooltipname2)].y,-50);
@@ -67,19 +66,11 @@
         set(layer[get(tooltipname2)].url,'%SWFPATH%/plugins/textfield.swf');
         set(layer[get(tooltipname2)].border,false);
         set(layer[get(tooltipname2)].align,center);
-        set(layer[get(tooltipname2)].ath,0);
-        set(layer[get(tooltipname2)].atv,0);
-
-        trace(get(name),'--ath::',get(hotspot[get(name)].ath));
-        trace(get(name),'--atv::',get(hotspot[get(name)].atv));
-        <!-- set(layer[get(tooltipname2)].ath,get(hotspot[get(schp_name)].ath);
-        set(layer[get(tooltipname2)].atv,get(hotspot[get(schp_name)].atv); -->
         set(layer[get(tooltipname2)].ondown,'draglayer();');
-        <!-- set(layer[get(tooltipname2)].ondown,'draghotspot1()'); -->
 
         txtadd(labelCode, '<div style="display: flex; align-items: center; justify-content: center; position: relative; border: 0px solid rgba(255,255,255,1); padding: 6px 10px; white-space: pre; border-radius: 5px; background: rgba(0,0,0,0.5);">','            <div style="text-align: left; font-size: 12px; color: rgba(255,255,255,1); line-height: 1.4;">',get(hotspottitle),'</div></div>'); 
 
-        copy(layer[get(tooltipname2)].html, labelCode)
+        copy(layer[get(tooltipname2)].html, labelCode);
             
     </action>
 
@@ -87,61 +78,49 @@
     <action name="draglayer"> 
        txtadd(hsName, '', get(name)); 
        txtreplace(hsName, 'tooltip2_', ''); 
-
-        <!-- spheretoscreen(ath, atv, x, y, 'l'); -->
-
-        copy(drag_currentx, x);
+       
+        <!-- copy(drag_currentx, x);
         copy(drag_currenty, y);
         copy(drag_stagex, mouse.stagex); 
         copy(drag_stagey, mouse.stagey);
         indexoftxt(align_contains_right, get(align), 'right');
         indexoftxt(align_contains_bottom, get(align), 'bottom'); 
         calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
-        calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);   
+        calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);    
         
-        <!-- 计算热点中心点 -->
-
-        copy(hx, hotspot[get(hsName)].x);
-        copy(hy, hotspot[get(hsName)].y);
-
-
-
+        -->
+        
+        copy(hath, hotspot[get(hsName)].ath);
+        copy(hatv, hotspot[get(hsName)].atv);
+        spheretoscreen(hath, hatv, hotspotcenterx, hotspotcentery, 'l');
+        sub(drag_adjustx,mouse.stagex, hotspotcenterx);
+        sub(drag_adjusty,mouse.stagey, hotspotcentery); 
+    
         asyncloop(
+             <!-- 计算热点中心点 -->
             pressed,
-             calc(x, drag_currentx + (mouse.stagex - drag_stagex) * drag_align_x);
-             calc(y, drag_currenty + (mouse.stagey - drag_stagey) * drag_align_y);
-    
-             <!-- trace('debug-callout::','hx::',hotspot[get(hsName)]); -->
-             <!-- sub(dx, mouse.stagex, x);
-             sub(dy, mouse.stagey, y);
-             screentosphere(dx, dy, ath, atv);  -->
-             <!-- set(hotspot[get(tooltipName)].width,20); -->
-             <!-- trace('hp1::',x,y);
-             trace('hp2::',dx,dy); -->
-             <!-- set(hotspot[get(tooltipName)].ath,ath);
-             set(hotspot[get(tooltipName)].atv,atv); -->
-             <!-- set(hotspot[%1].atv,atv); -->
-             <!-- trace('draglayer-callout::','ath::',ath,'atv::',atv); -->
+            sub(dx, mouse.stagex, drag_adjustx);
+            sub(dy, mouse.stagey, drag_adjusty);
+            screentosphere(dx, dy, vath, vatv); 
+              <!-- 更新 -->
+            copy(hotspot[get(hsName)].ath, vath);
+            copy(hotspot[get(hsName)].atv, vatv);
         );   
-   
-  
 
     </action>
 
 
+
     <action name="draghotspot1">
-    
-        <!-- trace('draghotspot1-callin::','ath::',ath,'atv::',atv); -->
         spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, 'l');
         sub(drag_adjustx,mouse.stagex, hotspotcenterx);
         sub(drag_adjusty,mouse.stagey, hotspotcentery); 
-
+    
         asyncloop(
             pressed, 
-            sub(x, mouse.stagex, drag_adjustx);
-            sub(y, mouse.stagey, drag_adjusty);
-            screentosphere(x, y, ath, atv); 
-            trace('draghotspot1-callout::','ath::',ath,'atv::',atv);
+            sub(dx, mouse.stagex, drag_adjustx);
+            sub(dy, mouse.stagey, drag_adjusty);
+            screentosphere(dx, dy, ath, atv); 
         );
     </action>
 </krpano>

+ 23 - 0
packages/qjkankan-editor/public/static/template/skin/customTooltip.json

@@ -0,0 +1,23 @@
+{
+    "id": "",
+    "title": "",
+    "type": 0, 
+    "contentType": "",
+    "ath": 0,
+    "atv": 0,
+    "link": "",
+    "icon": "",
+    "visible": true,
+    "style": {
+        "fontSize": 12,
+        "positon": "top",
+        "isHover": false,
+        "borderColor": "",
+        "isShowLine": "",
+        "isTextWrap": "",
+        "lineDirection": "",
+        "textColor": "",
+        "textDirection": "",
+        "textNumPerLine": ""
+    }
+}

+ 54 - 0
packages/qjkankan-editor/src/core/hotspot.js

@@ -0,0 +1,54 @@
+/**
+ * krpano 1.20 全景hotspot统一schema
+ *
+ * 
+ *  */
+const initState = {
+    id: "",
+    title: "",
+    type: 0, // 热点大类型 
+    ath: 0,
+    atv: 0,
+    link: "",
+    icon: "",
+    visible: true,
+    style: {
+        fontSize: 12,
+        position: "top",
+        isHover: false,
+        borderColor: "",
+        isShowLine: "",
+        isTextWrap: "",
+        lineDirection: "",
+        textColor: "",
+        textDirection: "",
+        textNumPerLine: "",
+        duration: 0,
+        frameNumber: 0,
+    }
+}
+
+const coverSystemIconPart = (origin) => {
+    const duplicate = Object.assign({}, initState);
+    duplicate.id = origin.name;
+    duplicate.title = origin.hotspotTitle;
+    duplicate.ath = origin.ath;
+    duplicate.atv = origin.atv;
+    duplicate.type = 0;
+    duplicate.icon = origin.img || '';
+    duplicate.link = origin.link || '';
+    duplicate.style.fontSize = origin.fontSize;
+}
+
+
+const convertJQHotspot = (origin) => {
+    const type = origin.hotspotIconType
+    switch (type) {
+        case 'system_icon':
+
+            break;
+        default:
+            break;
+    }
+}
+

+ 26 - 22
packages/qjkankan-editor/src/core/utils.js

@@ -85,31 +85,35 @@ export default class Utils {
     krpano.call("screentosphere(curscreen_x, curscreen_y, curscreen_ath, curscreen_atv);");
     let ath = krpano.get("curscreen_ath");
     let atv = krpano.get("curscreen_atv");
-
-    krpano.call(`addImgTextHotSpot(
-      ${param.img},
-      ${param.name},
-      ${param.hotspotTitle},
-      ${param.ath != '' ? param.ath : ath},
-      ${param.atv != '' ? param.atv : atv},
-      ${true},
-      ${type},
-      ${param.link},
-      ${true},
-      ${param.visible},
-      ${(param.size * 50) || 1},
-      ${Number(param.fontSize)})`);
+    console.warn('hotspot-data',param,type);
+    /**
+     * type: 0,系统图标 , 1.自定义图际. 2.序列帧  3.个性标签
+     */
+
+    // krpano.call(`addJQHotspot(
+    //   ${param.img},
+    //   ${param.name},
+    //   ${param.hotspotTitle},
+    //   ${param.ath != '' ? param.ath : ath},
+    //   ${param.atv != '' ? param.atv : atv},
+    //   ${true},
+    //   ${type},
+    //   ${param.link},
+    //   ${true},
+    //   ${param.visible},
+    //   ${(param.size * 50) || 1},
+    //   ${Number(param.fontSize)})`);
 
 
     // 设置热点图片默认的偏移值
-    let offset = '-130%'
-    if (param.size < 1) {
-      offset = '-200%'
-    }
-    if (param.size > 1) {
-      offset = '-100%'
-    }
-    krpano.set('layer[tooltip_' + param.name + '].y', `${offset}`)
+    // let offset = '-130%'
+    // if (param.size < 1) {
+    //   offset = '-200%'
+    // }
+    // if (param.size > 1) {
+    //   offset = '-100%'
+    // }
+    // krpano.set('layer[tooltip_' + param.name + '].y', `${offset}`)
 
   }
 

+ 10 - 9
packages/qjkankan-view/src/sdk/QJKanKan/modules/Tags.js

@@ -37,19 +37,20 @@ export default class Tags extends Emiter {
         ${Number(param.fontSize)})`);
 
 
-    // 设置热点图片默认的偏移值
-    let offset = '-130%'
-    if (param.size < 1) {
-      offset = '-200%'
-    }
-    if (param.size > 1) {
-      offset = '-100%'
-    }
-    this.app.krpanoDom.set('layer[tooltip_' + param.name + '].y', `${offset}`)
+    // // 设置热点图片默认的偏移值
+    // let offset = '-130%'
+    // if (param.size < 1) {
+    //   offset = '-200%'
+    // }
+    // if (param.size > 1) {
+    //   offset = '-100%'
+    // }
+    // this.app.krpanoDom.set('layer[tooltip_' + param.name + '].y', `${offset}`)
 
   }
 
 
+
   /**
   * 初始化
   */