customTooltip.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <krpano>
  2. <!-- 1.20. 新热点模式 -->
  3. <action name="addJQHotspot">
  4. showlog();
  5. set(hsp_name,%1);
  6. set(hsp_type,%2);
  7. txtadd(iconUrl,'',%4);
  8. txtreplace(iconUrl,'|',',');
  9. if(%2 LE 1,
  10. <!-- trace('id==',get(hsp_name),"::",get(iconUrl)); -->
  11. set(hotspot[get(hsp_name)].type,'image');
  12. set(hotspot[get(hsp_name)].url,get(iconUrl));
  13. );
  14. ifnot(%2 LE 1, set(hotspot[get(hsp_name)].type, 'text'));
  15. <!-- 其他标签 (0,1,2)-->
  16. if(%2 LT 2,
  17. set(hotspot[get(hsp_name)].height,%8);
  18. set(hotspot[get(hsp_name)].width,'prop');
  19. txtadd(hotspot[get(hsp_name)].onloaded,"add_tooltip_label();");
  20. );
  21. set(hotspot[get(hsp_name)].name,%1);
  22. set(hotspot[get(hsp_name)].hotspottype,%2);
  23. set(hotspot[get(hsp_name)].hotspottitle,%3);
  24. set(hotspot[get(hsp_name)].hotspotStyle,%10);
  25. set(hotspot[get(hsp_name)].ath,%5);
  26. set(hotspot[get(hsp_name)].atv,%6);
  27. set(hotspot[get(hsp_name)].visible,true);
  28. set(hotspot[get(hsp_name)].alpha,1);
  29. set(hotspot[get(hsp_name)].scale,1);
  30. set(hotspot[get(hsp_name)].autoalpha,false);
  31. set(hotspot[get(hsp_name)].distorted,false);
  32. set(hotspot[get(hsp_name)].ondown,dragJQhotspot(););
  33. set(hotspot[get(hsp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv))));
  34. txtsplit(%10,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber);
  35. <!-- 个性化标签(3) -->
  36. if(%2 == 3,
  37. set(hotspot[get(hsp_name)].height,80);
  38. set(hotspot[get(hsp_name)].width,1);
  39. set(hotspot[get(hsp_name)].padding,0);
  40. set(hotspot[get(hsp_name)].background,false);
  41. txtadd(line,'<div style="background-color: ',get(borderColor),';width:1px;height:80px;"></div>');
  42. trace('tags::',tagStyle);
  43. copy(hotspot[get(hsp_name)].html,line);
  44. txtadd(hotspot[get(hsp_name)].onloaded,"add_tooltip_label();add_tooltip_dot();");
  45. if(
  46. lineDirection == 'right-top',
  47. set(hotspot[get(hsp_name)].rotate,35);
  48. );
  49. if(
  50. lineDirection == 'right-center',
  51. set(hotspot[get(hsp_name)].rotate,90);
  52. );
  53. if(
  54. lineDirection == 'right-bottom',
  55. set(hotspot[get(hsp_name)].rotate,-35);
  56. );
  57. if(
  58. lineDirection == 'left-top',
  59. set(hotspot[get(hsp_name)].rotate,-35);
  60. );
  61. if(
  62. lineDirection == 'left-center',
  63. set(hotspot[get(hsp_name)].rotate,90);
  64. );
  65. if(
  66. lineDirection == 'left-bottom',
  67. set(hotspot[get(hsp_name)].rotate,35);
  68. );
  69. );
  70. addhotspot(get(hsp_name));
  71. </action>
  72. <action name="add_tooltip_label">
  73. txtadd(tooltipname, 'tooltip_', get(name));
  74. txtsplit(hotspotStyle,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber);
  75. addlayer(get(tooltipname));
  76. set(labelParent,get(name));
  77. txtadd(layer[get(tooltipname)].parent, 'hotspot[', get(name), ']');
  78. set(layer[get(tooltipname)].autowidth, true);
  79. set(layer[get(tooltipname)].width,'prop');
  80. set(layer[get(tooltipname)].height,30);
  81. set(layer[get(tooltipname)].edge,center);
  82. set(layer[get(tooltipname)].background,false);
  83. set(layer[get(tooltipname)].x,0);
  84. set(layer[get(tooltipname)].y,-45);
  85. set(layer[get(tooltipname)].padding,0);
  86. set(layer[get(tooltipname)].type,'html');
  87. set(layer[get(tooltipname)].url,'%SWFPATH%/plugins/textfield.swf');
  88. set(layer[get(tooltipname)].border,false);
  89. set(layer[get(tooltipname)].align,center);
  90. set(layer[get(tooltipname)].ondown,'dragJQlayer();');
  91. set(layer[get(tooltipname)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(hsName),get(vath),get(vatv))));
  92. <!-- set(hotspot[get(hsp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv)))); -->
  93. 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:',get(fontSize),'px; color: rgba(255,255,255,1); line-height: 1.4;">',get(hotspottitle),'</div>
  94. </div>');
  95. <!-- 个性化标签(3) -->
  96. if(get(hotspottype) == 3,
  97. trace('lineDirection2::',lineDirection);
  98. txtadd(labelCode, '<div style="display: flex; align-items: center; justify-content: center; position: relative; border: 1px solid ',get(borderColor),'; padding: 6px 10px; white-space: pre; border-radius: 5px; background: ',get(fillColor),'">','<div style="text-align: left; font-size:',get(fontSize),'px; color: ',get(textColor),'; line-height: 1.4;">',get(hotspottitle),'</div></div>');
  99. if(
  100. lineDirection == 'right-top',
  101. set(layer[get(tooltipname)].y,-60);
  102. set(layer[get(tooltipname)].rotate,-35);
  103. );
  104. if(
  105. lineDirection == 'right-center',
  106. set(layer[get(tooltipname)].x,0);
  107. set(layer[get(tooltipname)].y,-80);
  108. set(layer[get(tooltipname)].rotate,-90);
  109. );
  110. if(
  111. lineDirection == 'right-bottom',
  112. set(layer[get(tooltipname)].y,60);
  113. set(layer[get(tooltipname)].rotate,35);
  114. );
  115. if(
  116. lineDirection == 'center-top',
  117. set(layer[get(tooltipname)].y,-55);
  118. );
  119. if(
  120. lineDirection == 'center-bottom',
  121. set(layer[get(tooltipname)].y,55);
  122. );
  123. if(
  124. lineDirection == 'left-top',
  125. set(layer[get(tooltipname)].y,-60);
  126. set(layer[get(tooltipname)].rotate,35);
  127. );
  128. if(
  129. lineDirection == 'left-center',
  130. set(layer[get(tooltipname)].x,0);
  131. set(layer[get(tooltipname)].y,80);
  132. set(layer[get(tooltipname)].rotate,-90);
  133. );
  134. if(
  135. lineDirection == 'left-bottom',
  136. set(layer[get(tooltipname)].x,0);
  137. set(layer[get(tooltipname)].y,60);
  138. set(layer[get(tooltipname)].rotate,-35);
  139. );
  140. );
  141. copy(layer[get(tooltipname)].html, labelCode);
  142. </action>
  143. <!-- <style name="tooltip_dot_bg" type="container" border-radius="50%" bgcolor="0xFFFFFF" bgalpha="0.9" height="20" width="20" keep="true" /> -->
  144. <action name='add_tooltip_dot'>
  145. txtadd(tooldot, 'tooldot_', get(name));
  146. trace('hey::',get(borderColor));
  147. addlayer(get(tooldot));
  148. txtadd(layer[get(tooldot)].parent, 'hotspot[', get(name), ']');
  149. set(layer[get(tooldot)].width,10);
  150. set(layer[get(tooldot)].height,10);
  151. set(layer[get(tooldot)].padding,0);
  152. set(layer[get(tooldot)].align,center);
  153. set(layer[get(tooldot)].type,'text');
  154. set(layer[get(tooldot)].background,false);
  155. txtadd(dborderColor,'rgba(255,255,255,0.5)');
  156. txtadd(line,'<div style="background-color: ',get(borderColor),';width:10px;height:10px;"></div>');
  157. copy(layer[get(tooldot)].html,line);
  158. set(layer[get(tooldot)].backgroundcolor,get(borderColor));
  159. set(layer[get(tooldot)].backgroundalpha,0.9);
  160. set(layer[get(tooldot)].bgroundedge,5);
  161. set(layer[get(tooldot)].ondown,'dragJQlayer();');
  162. set(layer[get(tooldotupdateHotSpotData )].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(hsName),get(vath),get(vatv))));
  163. <!-- 个性化标签(3) -->
  164. if(get(hotspottype) == 3,
  165. trace('lineDirection3::',lineDirection);
  166. if(
  167. lineDirection == 'right-top',
  168. set(layer[get(tooldot)].x,0);
  169. set(layer[get(tooldot)].y,40);
  170. );
  171. if(
  172. lineDirection == 'right-center',
  173. set(layer[get(tooldot)].x,0);
  174. set(layer[get(tooldot)].y,40);
  175. );
  176. if(
  177. lineDirection == 'right-bottom',
  178. set(layer[get(tooldot)].x,0);
  179. set(layer[get(tooldot)].y,-40);
  180. );
  181. if(
  182. lineDirection == 'center-top',
  183. set(layer[get(tooldot)].x,0);
  184. set(layer[get(tooldot)].y,40);
  185. );
  186. if(
  187. lineDirection == 'center-bottom',
  188. set(layer[get(tooldot)].x,0);
  189. set(layer[get(tooldot)].y,-40);
  190. );
  191. if(
  192. lineDirection == 'left-top',
  193. set(layer[get(tooldot)].x,0);
  194. set(layer[get(tooldot)].y,40);
  195. );
  196. if(
  197. lineDirection == 'left-center',
  198. set(layer[get(tooldot)].x,0);
  199. set(layer[get(tooldot)].y,-40);
  200. );
  201. if(
  202. lineDirection == 'left-bottom',
  203. set(layer[get(tooldot)].x,0);
  204. set(layer[get(tooldot)].y,-40);
  205. );
  206. );
  207. </action>
  208. <action name="editJQHotspot">
  209. showlog();
  210. set(hsp_name,%1);
  211. set(hsp_type,%2);
  212. trace('edit');
  213. </action>
  214. <action name="dragJQlayer">
  215. txtadd(hsName, '', get(name));
  216. txtreplace(hsName, 'tooltip_', '');
  217. txtreplace(hsName, 'tooldot_', '');
  218. <!-- trace('drag::',hsName); -->
  219. <!-- copy(drag_currentx, x);
  220. copy(drag_currenty, y);
  221. copy(drag_stagex, mouse.stagex);
  222. copy(drag_stagey, mouse.stagey);
  223. indexoftxt(align_contains_right, get(align), 'right');
  224. indexoftxt(align_contains_bottom, get(align), 'bottom');
  225. calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
  226. calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);
  227. -->
  228. copy(hath, hotspot[get(hsName)].ath);
  229. copy(hatv, hotspot[get(hsName)].atv);
  230. spheretoscreen(hath, hatv, hotspotcenterx, hotspotcentery, 'l');
  231. sub(drag_adjustx,mouse.stagex, hotspotcenterx);
  232. sub(drag_adjusty,mouse.stagey, hotspotcentery);
  233. asyncloop(
  234. <!-- 计算热点中心点 -->
  235. pressed,
  236. sub(dx, mouse.stagex, drag_adjustx);
  237. sub(dy, mouse.stagey, drag_adjusty);
  238. screentosphere(dx, dy, vath, vatv);
  239. <!-- 更新 -->
  240. copy(hotspot[get(hsName)].ath, vath);
  241. copy(hotspot[get(hsName)].atv, vatv);
  242. );
  243. </action>
  244. <action name="dragJQhotspot">
  245. spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, 'l');
  246. sub(drag_adjustx,mouse.stagex, hotspotcenterx);
  247. sub(drag_adjusty,mouse.stagey, hotspotcentery);
  248. asyncloop(
  249. pressed,
  250. sub(dx, mouse.stagex, drag_adjustx);
  251. sub(dy, mouse.stagey, drag_adjusty);
  252. screentosphere(dx, dy, ath, atv);
  253. );
  254. </action>
  255. </krpano>