tooltip.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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. trace('opentype::',%11);
  10. if(%2 LE 1,
  11. <!-- trace('id==',get(hsp_name),"::",get(iconUrl)); -->
  12. set(hotspot[get(hsp_name)].type,'image');
  13. set(hotspot[get(hsp_name)].url,get(iconUrl));
  14. );
  15. ifnot(%2 LE 1, set(hotspot[get(hsp_name)].type, 'text'));
  16. <!-- 其他标签 (0,1,2)-->
  17. set(hotspot[get(hsp_name)].name,%1);
  18. set(hotspot[get(hsp_name)].hotspottype,%2);
  19. set(hotspot[get(hsp_name)].hotspottitle,%3);
  20. set(hotspot[get(hsp_name)].hotspotStyle,%10);
  21. set(hotspot[get(hsp_name)].opentype,%11);
  22. set(hotspot[get(hsp_name)].hotlink,%7);
  23. set(hotspot[get(hsp_name)].ath,%5);
  24. set(hotspot[get(hsp_name)].atv,%6);
  25. set(hotspot[get(hsp_name)].visible,true);
  26. set(hotspot[get(hsp_name)].alpha,1);
  27. set(hotspot[get(hsp_name)].scale,1);
  28. set(hotspot[get(hsp_name)].autoalpha,false);
  29. set(hotspot[get(hsp_name)].distorted,false);
  30. set(hotspot[get(hsp_name)].border,false);
  31. <!-- set(hotspot[get(hsp_name)].onclick,'js(__krfn.utils.linkopen(%7,%1)); '); -->
  32. set(hotspot[get(hsp_name)].onclick,'js(__sdk.Tags.linkopen(%11,%1)); ');
  33. <!-- set(hotspot[get(hsp_name)].ondown,dragJQhotspot(););
  34. set(hotspot[get(hsp_name)].onup,js(console.log('0');__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv)))); -->
  35. txtsplit(%10,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber,framewidth);
  36. set(hotspot[get(hsp_name)].pos,pos);
  37. txtadd(hotspot[get(hsp_name)].onloaded,"add_tooltip_label();add_tooltip_dot();");
  38. if(%2 LE 2,
  39. set(hotspot[get(hsp_name)].height,%8);
  40. set(hotspot[get(hsp_name)].width,%8);
  41. set(hotspot[get(hsp_name)].crop,'');
  42. if(%2 == 0,
  43. txtreplace(iconUrl,'.svg','.png');
  44. trace('system::',get(iconUrl));
  45. set(hotspot[get(hsp_name)].url,get(iconUrl));
  46. set(hotspot[get(hsp_name)].frameNumber,60);
  47. set(hotspot[get(hsp_name)].duration,1);
  48. set(hotspot[get(hsp_name)].frameRate,calc(1.0 / 60));
  49. set(hotspot[get(hsp_name)].framewidth,84);
  50. );
  51. if(%2 == 2,
  52. trace('ser_frame::',get(framewidth));
  53. set(hotspot[get(hsp_name)].url,get(iconUrl));
  54. set(hotspot[get(hsp_name)].framewidth,get(framewidth));
  55. set(hotspot[get(hsp_name)].frameNumber,get(frameNumber));
  56. );
  57. );
  58. <!-- 个性化标签(3) -->
  59. if(%2 == 3,
  60. set(hotspot[get(hsp_name)].height,80);
  61. set(hotspot[get(hsp_name)].width,1);
  62. set(hotspot[get(hsp_name)].padding,0);
  63. set(hotspot[get(hsp_name)].background,false);
  64. txtadd(line,'<div style="background-color: ',get(borderColor),';width:1px;height:80px;"></div>');
  65. copy(hotspot[get(hsp_name)].html,line);
  66. <!-- txtadd(hotspot[get(hsp_name)].onloaded,"add_tooltip_label();add_tooltip_dot();"); -->
  67. set_label_dir(get(hsp_name),get(lineDirection),0);
  68. );
  69. txtadd(hotspot[get(hsp_name)].onloaded,"make_hotsport_animation(get(framewidth),get(framewidth),get(frameRate));");
  70. trace('last_add::',hotspot[get(hsp_name)].onloaded);
  71. addhotspot(get(hsp_name));
  72. </action>
  73. <action name="make_hotsport_animation">
  74. <!-- 1 square:(w/h) 2:imageW 3 imageH 4 frameRate -->
  75. trace('imagewidth::',imagewidth,'::imageheight::',imageheight);
  76. registerattribute(xframes, calc((imagewidth / %1) BOR 0));
  77. registerattribute(yframes, calc((imageheight / %2) BOR 0));
  78. registerattribute(frames, calc(xframes * yframes));
  79. registerattribute(frame, 0);
  80. registerattribute(animatiedOn, 1);
  81. registerattribute(frameRate, %3);
  82. trace('frameRate::',get(frameRate));
  83. set(crop, '0|0|%1|%2');
  84. clearinterval(calc('crop_anim_' + name));
  85. if(%3 == '' OR frameRate == 0 OR isNaN(frameRate),
  86. set(frameRate,calc(1.0 / 60));
  87. trace('没有frameRate',get(calc(1.0 / 60)));
  88. trace('没有frameRate-1',get(frameRate));
  89. );
  90. trace('params::1::',%1,'::2::',%2,'::3::',%3,':frameRate:',get(frameRate));
  91. trace('xframes1::',get(xframes),'::yframes1::',get(yframes));
  92. if(frameRate GE 0,
  93. setinterval(
  94. calc('crop_anim_' + name),
  95. get(frameRate),
  96. if(loaded,
  97. inc(frame);
  98. <!-- trace('frame::',get(frame),'xframes2::',get(xframes),'::yframes2::',get(yframes)); -->
  99. if(frame GE frames, if(onlastframe !== null, onlastframe() ); set(frame,0); );
  100. mod(xpos,frame, xframes);
  101. div(ypos, frame, xframes);
  102. Math.floor(ypos);
  103. mul(xpos, %1);
  104. mul(ypos, %2);
  105. calc(crop, xpos +'|' + ypos + '|%1|%2');
  106. if(animatiedOn == 0,
  107. calc(stopAniCrop,'0|0|'+imagewidth+'|'+imageheight +'|');
  108. set(crop, stopAniCrop);
  109. );,
  110. clearinterval(calc('crop_anim_' + name));
  111. );
  112. );
  113. );
  114. </action>
  115. <action name="add_tooltip_label">
  116. txtadd(tooltipname, 'tooltip_', get(name));
  117. txtsplit(hotspotStyle,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber);
  118. txtadd(pName, get(name));
  119. addlayer(get(tooltipname));
  120. txtadd(layer[get(tooltipname)].parent, 'hotspot[', get(name), ']');
  121. set(layer[get(tooltipname)].autowidth, true);
  122. set(layer[get(tooltipname)].width,'prop');
  123. set(layer[get(tooltipname)].autoheight,true);
  124. set(layer[get(tooltipname)].edge,center);
  125. set(layer[get(tooltipname)].background,false);
  126. set(layer[get(tooltipname)].pos,pos);
  127. set(layer[get(tooltipname)].padding,0);
  128. set(layer[get(tooltipname)].type,'html');
  129. set(layer[get(tooltipname)].url,'%SWFPATH%/plugins/textfield.swf');
  130. set(layer[get(tooltipname)].border,false);
  131. set(layer[get(tooltipname)].align,center);
  132. copy(layer[get(tooltipname)].hotlink, hotspot[get(name)].hotlink);
  133. <!-- set(layer[get(tooltipname)].ondown,'dragJQlayer();'); -->
  134. set(layer[get(tooltipname)].onclick,JQlayerClick);
  135. <!-- set(layer[get(tooltipname)].onup,js(console.log('1');__krfn.angle.updateHotSpotData(get(xml.scene),get(hsName),get(ath),get(atv)))); -->
  136. <!-- set(hotspot[get(hsp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv)))); -->
  137. 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>
  138. </div>');
  139. <!-- label方位 -->
  140. if(get(hotspottype) LE 2,
  141. <!-- trace('hotspottype::',get(hotspottype),'::tooltipname::',get(tooltipname),'pos::',get(pos)); -->
  142. <!-- set_label_pos(get(tooltipname),get(pos)); -->
  143. delayedcall(0.1,
  144. txtadd(tooltipname, 'tooltip_', get(name));
  145. set_label_pos(get(tooltipname),get(pos));
  146. );
  147. );
  148. <!-- 个性化标签(3) -->
  149. if(get(hotspottype) == 3,
  150. trace('add_tooltip_label::',get(lineDirection));
  151. set(layer[get(tooltipname)].direction,get(lineDirection));
  152. delayedcall(0.2,txtadd(tooltipname, 'tooltip_', get(name)); set_label_dir(get(tooltipname),get(layer[get(tooltipname)].direction),1); );
  153. );
  154. copy(layer[get(tooltipname)].html, labelCode);
  155. </action>
  156. <!-- <style name="tooltip_dot_bg" type="container" border-radius="50%" bgcolor="0xFFFFFF" bgalpha="0.9" height="20" width="20" keep="true" /> -->
  157. <action name='add_tooltip_dot'>
  158. txtadd(tooldot, 'tooldot_', get(name));
  159. <!-- trace('hey::',get(borderColor)); -->
  160. <!-- trace('add-dot-type::',get(name),'::',get(hotspottype)); -->
  161. addlayer(get(tooldot));
  162. txtadd(layer[get(tooldot)].parent, 'hotspot[', get(name), ']');
  163. set(layer[get(tooldot)].width,10);
  164. set(layer[get(tooldot)].height,10);
  165. set(layer[get(tooldot)].padding,0);
  166. set(layer[get(tooldot)].align,center);
  167. set(layer[get(tooldot)].type,'text');
  168. set(layer[get(tooldot)].background,false);
  169. txtadd(dborderColor,'rgba(255,255,255,0.5)');
  170. txtadd(dot,'<div style="background-color: ',get(borderColor),';width:10px;height:10px;"></div>');
  171. copy(layer[get(tooldot)].html,dot);
  172. set(layer[get(tooldot)].backgroundcolor,get(borderColor));
  173. set(layer[get(tooldot)].backgroundalpha,0.9);
  174. set(layer[get(tooldot)].bgroundedge,5);
  175. set(layer[get(tooldot)].onclick,JQlayerClick);
  176. <!-- set(layer[get(tooldot)].ondown,'dragJQlayer();'); -->
  177. set(layer[get(tooldot)].visible,false);
  178. <!-- set(layer[get(tooldot)].onup,js(console.log('2');__krfn.angle.updateHotSpotData(get(xml.scene),get(hsName),get(ath),get(atv)))); -->
  179. <!-- 个性化标签(3) -->
  180. if(get(hotspottype) == 3,
  181. <!-- trace('lineDirection3::',lineDirection); -->
  182. <!-- call(set_label_dir); -->
  183. set(layer[get(tooldot)].visible,true);
  184. set_label_dir(get(tooldot),get(lineDirection),2);
  185. );
  186. </action>
  187. <action name='set_label_dir'>
  188. txtadd(dirItem,'',%1);
  189. txtadd(lineDirection,'',%2);
  190. txtadd(dir,'',%3);
  191. <!-- trace('get-lineDirection::',%2); -->
  192. <!-- trace('set_label_dir::1::',get(dirItem),'::2::',get(lineDirection),'::3::',get(dir)); -->
  193. if(
  194. get(dir)==1,
  195. <!-- trace('set_label_dir::1::',get(dirItem),'::2::',get(lineDirection),'::3::',get(dir)); -->
  196. copy(labelWidth,layer[get(dirItem)].width);
  197. copy(labelHeight,layer[get(dirItem)].height);
  198. );
  199. if(
  200. get(lineDirection) == 'right-top',
  201. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,35));
  202. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,-1);set(layer[get(dirItem)].rotate,0);set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,get(allHeight));set(layer[get(dirItem)].rotate,-35););
  203. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  204. );
  205. if(
  206. get(lineDirection) == 'right-center',
  207. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,90););
  208. if(get(dir)==1,
  209. set(layer[get(dirItem)].rotate,-90);
  210. add(allWidth,labelWidth,80);
  211. div(allWidth,2);
  212. mul(allWidth,-1);
  213. trace('allWidth::',get(allWidth));
  214. set(layer[get(dirItem)].x,0);
  215. set(layer[get(dirItem)].y,get(allWidth));
  216. );
  217. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  218. );
  219. if(
  220. get(lineDirection) == 'right-bottom',
  221. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,-35));
  222. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,1);set(layer[get(dirItem)].rotate,0);set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,get(allHeight));set(layer[get(dirItem)].rotate,35););
  223. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  224. );
  225. if(
  226. get(lineDirection) == 'center-top',
  227. if(get(dir)==0,
  228. set(hotspot[get(dirItem)].rotate,0);
  229. );
  230. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,-1);set(layer[get(dirItem)].rotate,0);set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,get(allHeight)););
  231. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  232. );
  233. if(get(lineDirection) == 'center-bottom',
  234. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,0));
  235. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,1);
  236. set(layer[get(dirItem)].rotate,0);
  237. set(layer[get(dirItem)].x,0);
  238. set(layer[get(dirItem)].y,get(allHeight));
  239. );
  240. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  241. );
  242. if( get(lineDirection) == 'left-top',
  243. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,-35));
  244. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,-1);set(layer[get(dirItem)].rotate,0);set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,get(allHeight));set(layer[get(dirItem)].rotate,35););
  245. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  246. );
  247. if(
  248. get(lineDirection) == 'left-center',
  249. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,90));
  250. if(get(dir)==1,
  251. set(layer[get(dirItem)].rotate,-90);
  252. add(allWidth,labelWidth,80);
  253. div(allWidth,2);
  254. trace('allWidth::',get(allWidth));
  255. set(layer[get(dirItem)].x,0);
  256. set(layer[get(dirItem)].y,get(allWidth));
  257. );
  258. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  259. );
  260. if(
  261. get(lineDirection) == 'left-bottom',
  262. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,35));
  263. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,1);set(layer[get(dirItem)].rotate,0);set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,get(allHeight));set(layer[get(dirItem)].rotate,-35););
  264. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  265. );
  266. </action>
  267. <action name='set_label_pos'>
  268. <!-- label方位 -->
  269. set(posName,%1);
  270. set(pos,%2);
  271. copy(hp,posName);
  272. txtreplace(hp,'tooltip_','');
  273. copy(hwidth, hotspot[get(hp)].width);
  274. copy(hheight, hotspot[get(hp)].height);
  275. copy(lwidth, layer[get(posName)].width);
  276. copy(lheight, layer[get(posName)].height);
  277. if(
  278. pos == 'top',
  279. add(all,lheight,hheight);
  280. div(dpy,all,2);
  281. add(lastPy,dpy,5);
  282. trace('dpy::',dpy);
  283. mul(lastPy, -1);
  284. set(layer[get(posName)].align,center);
  285. set(layer[get(posName)].y,get(lastPy));
  286. set(layer[get(posName)].x,0);
  287. );
  288. if(
  289. pos == 'bottom',
  290. add(all,lheight,hheight);
  291. div(dpy,all,2);
  292. add(lastPy,dpy,5);
  293. mul(lastPy, 1);
  294. set(layer[get(posName)].align,center);
  295. set(layer[get(posName)].y,get(lastPy));
  296. set(layer[get(posName)].x,0);
  297. );
  298. if(
  299. pos == 'left',
  300. add(all,lwidth,hwidth);
  301. div(dpx,all,2);
  302. add(lastPx,dpx,10);
  303. mul(lastPx, -1);
  304. set(layer[get(posName)].align,center);
  305. set(layer[get(posName)].x,get(lastPx));
  306. set(layer[get(posName)].y,0);
  307. );
  308. if(
  309. pos == 'right',
  310. add(all,lwidth,hwidth);
  311. div(dpx,all,2);
  312. add(lastPx,dpx,10);
  313. mul(lastPx, 1);
  314. set(layer[get(posName)].align,center);
  315. set(layer[get(posName)].x,get(lastPx));
  316. set(layer[get(posName)].y,0);
  317. );
  318. </action>
  319. <action name='JQlayerClick'>
  320. txtadd(clickName, '', get(name));
  321. txtreplace(clickName, 'tooltip_', '');
  322. txtreplace(clickName, 'tooldot_', '');
  323. trace('opentype::',get(hotspot[get(clickName)].opentype));
  324. trace('clickName::',get(clickName));
  325. js(__sdk.Tags.linkopen(get(hotspot[get(clickName)].opentype),get(clickName)));
  326. </action>
  327. </krpano>