tooltip.xml 17 KB

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