customTooltip.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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('originName::',%1); -->
  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)].hotlink,%7);
  22. set(hotspot[get(hsp_name)].ath,%5);
  23. set(hotspot[get(hsp_name)].atv,%6);
  24. set(hotspot[get(hsp_name)].hoverstatus, %9);
  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)].ondown,dragJQhotspot(););
  33. set(hotspot[get(hsp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv),0)));
  34. txtsplit(%10,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber,framewidth);
  35. set(hotspot[get(hsp_name)].pos,pos);
  36. txtadd(hotspot[get(hsp_name)].onloaded,"add_tooltip_label();add_tooltip_dot();");
  37. trace('hoverstatus::',%9);
  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('新增::',iconUrl); -->
  45. set(hotspot[get(hsp_name)].url,get(iconUrl));
  46. set(hotspot[get(hsp_name)].animatiedOn,1);
  47. set(hotspot[get(hsp_name)].frameNumber,40);
  48. set(hotspot[get(hsp_name)].xframes,1);
  49. set(hotspot[get(hsp_name)].yframes,40);
  50. set(hotspot[get(hsp_name)].frameRate,calc(1.0 / 60));
  51. set(hotspot[get(hsp_name)].framewidth,84);
  52. );
  53. if(%2 == 1,
  54. set(hotspot[get(hsp_name)].url,get(iconUrl));
  55. set(hotspot[get(hsp_name)].animatiedOn,0);
  56. );
  57. if(%2 == 2,
  58. set(hotspot[get(hsp_name)].url,get(iconUrl));
  59. set(hotspot[get(hsp_name)].framewidth,get(framewidth));
  60. set(hotspot[get(hsp_name)].frameNumber,get(frameNumber));
  61. set(hotspot[get(hsp_name)].frameRate,calc(1.0 / get(frameNumber)));
  62. );
  63. );
  64. <!-- 个性化标签(3) -->
  65. if(%2 == 3,
  66. trace('isShowLine::',isShowLine);
  67. set(hotspot[get(hsp_name)].height,80);
  68. set(hotspot[get(hsp_name)].width,1);
  69. set(hotspot[get(hsp_name)].padding,0);
  70. set(hotspot[get(hsp_name)].background,false);
  71. set(hotspot[get(hsp_name)].visible,false);
  72. txtadd(line,'<div style="background-color: ',get(borderColor),';width:1px;height:80px;"></div>');
  73. copy(hotspot[get(hsp_name)].html,line);
  74. if(isShowLine == 1, set_label_dir(get(hsp_name),get(lineDirection),0););
  75. if(isShowLine == 0,
  76. txtadd(tooltipname, 'tooltip_', get(hsp_name));
  77. txtadd(tooltipdot, 'tooldot_', get(hsp_name));
  78. <!-- set_label_dir(get(hsp_name),get(lineDirection),0); -->
  79. set(hotspot[get(hsp_name)].width,0);
  80. trace('隐藏标线::',get(tooltipdot));
  81. set(layer[get(tooltipname)].x,0);
  82. set(layer[get(tooltipname)].y,0);
  83. set(layer[get(tooltipname)].rotate,0);
  84. set(hotspot[get(hsp_name)].visible,true);
  85. set(layer[get(tooltipname)].visible,true);
  86. set(layer[get(tooltipdot)].visible,false);
  87. );
  88. );
  89. txtadd(hotspot[get(hsp_name)].onloaded,"do_crop_animation(get(framewidth),get(framewidth),get(frameRate));");
  90. <!-- trace('last_add::',hotspot[get(hsp_name)].onloaded); -->
  91. addhotspot(get(hsp_name));
  92. </action>
  93. <action name="do_crop_animation">
  94. <!-- 1 square:(w/h) 2:imageW 3 imageH 4 frameRate -->
  95. <!-- trace('imagewidth::',imagewidth,'::imageheight::',imageheight); -->
  96. registerattribute(xframes, calc((imagewidth / %1) BOR 0));
  97. registerattribute(yframes, calc((imageheight / %2) BOR 0));
  98. registerattribute(frames, calc(xframes * yframes));
  99. registerattribute(frame, 0);
  100. registerattribute(animatiedOn, 1);
  101. registerattribute(frameRate, %3);
  102. <!-- trace('frameRate::',get(frameRate)); -->
  103. set(crop, '0|0|%1|%2');
  104. clearinterval(calc('crop_anim_' + name));
  105. if(%3 == '' OR frameRate == 0 OR isNaN(frameRate),
  106. set(frameRate,calc(1.0 / 60));
  107. <!-- trace('没有frameRate',get(calc(1.0 / 60)));
  108. trace('没有frameRate-1',get(frameRate)); -->
  109. );
  110. <!-- trace('params::1::',%1,'::2::',%2,'::3::',%3,':frameRate:',get(frameRate));
  111. trace('xframes1::',get(xframes),'::yframes1::',get(yframes));
  112. -->
  113. if(frameRate GE 0,
  114. setinterval(
  115. calc('crop_anim_' + name),
  116. get(frameRate),
  117. if(loaded,
  118. inc(frame);
  119. <!-- trace('frame::',get(frame),'xframes2::',get(xframes),'::yframes2::',get(yframes)); -->
  120. if(frame GE frames, if(onlastframe !== null, onlastframe() ); set(frame,0); );
  121. mod(xpos,frame, xframes);
  122. div(ypos, frame, xframes);
  123. Math.floor(ypos);
  124. mul(xpos, %1);
  125. mul(ypos, %2);
  126. calc(crop, xpos +'|' + ypos + '|%1|%2');
  127. if(animatiedOn == 0,
  128. calc(stopAniCrop,'0|0|'+imagewidth+'|'+imageheight +'|');
  129. set(crop, stopAniCrop);
  130. );,
  131. clearinterval(calc('crop_anim_' + name));
  132. );
  133. );
  134. );
  135. </action>
  136. <action name="add_tooltip_label">
  137. txtadd(tooltipname, 'tooltip_', get(name));
  138. txtsplit(hotspotStyle,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber);
  139. txtadd(pName, get(name));
  140. addlayer(get(tooltipname));
  141. txtadd(layer[get(tooltipname)].parent, 'hotspot[', get(name), ']');
  142. set(layer[get(tooltipname)].autowidth, true);
  143. set(layer[get(tooltipname)].width,'prop');
  144. set(layer[get(tooltipname)].autoheight,true);
  145. set(layer[get(tooltipname)].edge,center);
  146. set(layer[get(tooltipname)].background,false);
  147. set(layer[get(tooltipname)].pos,pos);
  148. set(layer[get(tooltipname)].padding,0);
  149. set(layer[get(tooltipname)].type,'html');
  150. set(layer[get(tooltipname)].url,'%SWFPATH%/plugins/textfield.swf');
  151. set(layer[get(tooltipname)].border,false);
  152. set(layer[get(tooltipname)].align,center);
  153. copy(layer[get(tooltipname)].hotlink, hotspot[get(name)].hotlink);
  154. set(layer[get(tooltipname)].ondown,'dragJQlayer();');
  155. set(layer[get(tooltipname)].onclick,JQlayerClick);
  156. set(layer[get(tooltipname)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(hsName),get(ath),get(atv),1)));
  157. <!-- set(hotspot[get(hsp_name)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(name),get(ath),get(atv)))); -->
  158. 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>
  159. </div>');
  160. <!-- label方位 -->
  161. if(get(hotspottype) LE 2,
  162. <!-- trace('hotspottype::',get(hotspottype),'::tooltipname::',get(tooltipname),'pos::',get(pos)); -->
  163. <!-- set_label_pos(get(tooltipname),get(pos)); -->
  164. copy(hoverstatus,hotspot[get(name)].hoverstatus);
  165. trace('hovering-label::',get(hoverstatus));
  166. <!-- 0 一直显示 -->
  167. if(hoverstatus == 0,
  168. delayedcall(0.1,
  169. txtadd(tooltipname, 'tooltip_', get(name));
  170. set_label_pos(get(tooltipname),get(pos));
  171. );
  172. );
  173. if(hoverstatus == 1,
  174. set(layer[get(tooltipname)].visible,false);
  175. );
  176. <!-- 2 hover -->
  177. if(hoverstatus == 2,
  178. set(layer[get(tooltipname)].visible,false);
  179. delayedcall(0.1,
  180. txtadd(tooltipname, 'tooltip_', get(name));
  181. set_label_pos(get(tooltipname),get(pos));
  182. set(layer[get(tooltipname)].visible,false);
  183. );
  184. set(hotspot[get(name)].onhover,txtadd(tooltipname, 'tooltip_', get(name)); set(layer[get(tooltipname)].visible,true););
  185. set(hotspot[get(name)].onout,
  186. txtadd(tooltipname, 'tooltip_', get(name));
  187. set(layer[get(tooltipname)].visible,false);
  188. );
  189. );
  190. );
  191. <!-- 个性化标签(3) -->
  192. if(get(hotspottype) == 3,
  193. trace('tl-isShowLine::',get(hotspottitle),get(isShowLine));
  194. if(
  195. isShowLine==1,
  196. set(layer[get(tooltipname)].direction,get(lineDirection));
  197. delayedcall(0.2,txtadd(tooltipname, 'tooltip_', get(name)); set_label_dir(get(tooltipname),get(layer[get(tooltipname)].direction),1); );
  198. );
  199. txtreplace(labelCode,'font-size:15px;','font-size:14px;');
  200. );
  201. <!-- set(layer[get(tooltipname)].visible,true); -->
  202. copy(layer[get(tooltipname)].html, labelCode);
  203. </action>
  204. <!-- <style name="tooltip_dot_bg" type="container" border-radius="50%" bgcolor="0xFFFFFF" bgalpha="0.9" height="20" width="20" keep="true" /> -->
  205. <action name='add_tooltip_dot'>
  206. txtadd(tooldot, 'tooldot_', get(name));
  207. <!-- trace('hey::',get(borderColor)); -->
  208. <!-- trace('add-dot-type::',get(name),'::',get(hotspottype)); -->
  209. addlayer(get(tooldot));
  210. txtadd(layer[get(tooldot)].parent, 'hotspot[', get(name), ']');
  211. set(layer[get(tooldot)].width,10);
  212. set(layer[get(tooldot)].height,10);
  213. set(layer[get(tooldot)].padding,0);
  214. set(layer[get(tooldot)].align,center);
  215. set(layer[get(tooldot)].type,'text');
  216. set(layer[get(tooldot)].background,false);
  217. txtadd(dborderColor,'rgba(255,255,255,0.5)');
  218. txtadd(dot,'<div style="background-color: ',get(borderColor),';width:10px;height:10px;"></div>');
  219. copy(layer[get(tooldot)].html,dot);
  220. set(layer[get(tooldot)].backgroundcolor,get(borderColor));
  221. set(layer[get(tooldot)].backgroundalpha,0.9);
  222. set(layer[get(tooldot)].bgroundedge,5);
  223. set(layer[get(tooldot)].onclick,JQlayerClick);
  224. set(layer[get(tooldot)].ondown,'dragJQlayer();');
  225. set(layer[get(tooldot)].visible,false);
  226. set(layer[get(tooldot)].onup,js(__krfn.angle.updateHotSpotData(get(xml.scene),get(hsName),get(ath),get(atv),2)));
  227. <!-- 个性化标签(3) -->
  228. if(get(hotspottype) == 3,
  229. trace('add_tooltip_dot::',get(isShowLine));
  230. if(isShowLine ==1,set(layer[get(tooldot)].visible,true);set_label_dir(get(tooldot),get(lineDirection),2););
  231. if(isShowLine ==0,set(layer[get(tooldot)].visible,false););
  232. );
  233. </action>
  234. <action name='set_label_dir'>
  235. txtadd(dirItem,'',%1);
  236. txtadd(lineDirection,'',%2);
  237. txtadd(dir,'',%3);
  238. <!-- trace('get-lineDirection::',%2); -->
  239. <!-- trace('set_label_dir::1::',get(dirItem),'::2::',get(lineDirection),'::3::',get(dir)); -->
  240. if(
  241. get(dir)==1,
  242. <!-- trace('set_label_dir::1::',get(dirItem),'::2::',get(lineDirection),'::3::',get(dir)); -->
  243. copy(labelWidth,layer[get(dirItem)].width);
  244. copy(labelHeight,layer[get(dirItem)].height);
  245. );
  246. if(
  247. get(lineDirection) == 'right-top',
  248. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,35));
  249. 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););
  250. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  251. );
  252. if(
  253. get(lineDirection) == 'right-center',
  254. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,90););
  255. if(get(dir)==1,
  256. set(layer[get(dirItem)].rotate,-90);
  257. add(allWidth,labelWidth,80);
  258. div(allWidth,2);
  259. mul(allWidth,-1);
  260. trace('allWidth::',get(allWidth));
  261. set(layer[get(dirItem)].x,0);
  262. set(layer[get(dirItem)].y,get(allWidth));
  263. );
  264. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  265. );
  266. if(
  267. get(lineDirection) == 'right-bottom',
  268. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,-35));
  269. 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););
  270. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  271. );
  272. if(
  273. get(lineDirection) == 'center-top',
  274. if(get(dir)==0,
  275. set(hotspot[get(dirItem)].rotate,0);
  276. );
  277. 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)););
  278. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  279. );
  280. if(get(lineDirection) == 'center-bottom',
  281. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,0));
  282. if(get(dir)==1,add(allHeight,labelHeight,80);div(allHeight,2);mul(allHeight,1);
  283. set(layer[get(dirItem)].rotate,0);
  284. set(layer[get(dirItem)].x,0);
  285. set(layer[get(dirItem)].y,get(allHeight));
  286. );
  287. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  288. );
  289. if( get(lineDirection) == 'left-top',
  290. if(get(dir)==0,
  291. set(hotspot[get(dirItem)].rotate,-35);
  292. );
  293. if(get(dir)==1,
  294. add(allHeight,labelHeight,80);
  295. div(allHeight,2);mul(allHeight,-1);
  296. set(layer[get(dirItem)].rotate,0);
  297. Math.cos(dtrCos,calc(-35* Math.PI/180));
  298. Math.sin(dtrSin,calc(-35* Math.PI/180));
  299. set(dist,40);
  300. set(newX,calc(dist * dtrCos));
  301. set(newY,calc(dist * dtrSin + dist));
  302. <!-- newx = allHeight * Math.cos(dtrCos) + x -->
  303. trace('newX::',get(newX));
  304. trace('newY::',get(newY));
  305. <!-- trace('dtrSin::',dtrSin); -->
  306. copy(layer[get(dirItem)].x,0);
  307. copy(layer[get(dirItem)].y,allHeight);
  308. set(layer[get(dirItem)].rotate,35);
  309. <!-- set(layer[get(dirItem)].transfrom,'tranlate(100%)'); -->
  310. );
  311. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,40););
  312. );
  313. if(
  314. get(lineDirection) == 'left-center',
  315. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,90));
  316. if(get(dir)==1,
  317. set(layer[get(dirItem)].rotate,-90);
  318. add(allWidth,labelWidth,80);
  319. div(allWidth,2);
  320. trace('allWidth::',get(allWidth));
  321. set(layer[get(dirItem)].x,0);
  322. set(layer[get(dirItem)].y,get(allWidth));
  323. );
  324. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  325. );
  326. if(
  327. get(lineDirection) == 'left-bottom',
  328. if(get(dir)==0,set(hotspot[get(dirItem)].rotate,35));
  329. 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););
  330. if(get(dir)==2,set(layer[get(dirItem)].x,0);set(layer[get(dirItem)].y,-40););
  331. );
  332. if(get(dir)==0, set(hotspot[get(dirItem)].visible,true););
  333. if(get(dir)==1, set(layer[get(dirItem)].visible,true););
  334. if(get(dir)==2, set(layer[get(dirItem)].visible,true););
  335. </action>
  336. <action name='set_label_pos'>
  337. <!-- label方位 -->
  338. set(posName,%1);
  339. set(pos,%2);
  340. copy(hp,posName);
  341. txtreplace(hp,'tooltip_','');
  342. copy(hwidth, hotspot[get(hp)].width);
  343. copy(hheight, hotspot[get(hp)].height);
  344. copy(lwidth, layer[get(posName)].width);
  345. copy(lheight, layer[get(posName)].height);
  346. if(
  347. pos == 'top',
  348. add(all,lheight,hheight);
  349. div(dpy,all,2);
  350. add(lastPy,dpy,5);
  351. trace('dpy::',dpy);
  352. mul(lastPy, -1);
  353. set(layer[get(posName)].align,center);
  354. set(layer[get(posName)].y,get(lastPy));
  355. set(layer[get(posName)].x,0);
  356. );
  357. if(
  358. pos == 'bottom',
  359. add(all,lheight,hheight);
  360. div(dpy,all,2);
  361. add(lastPy,dpy,5);
  362. mul(lastPy, 1);
  363. set(layer[get(posName)].align,center);
  364. set(layer[get(posName)].y,get(lastPy));
  365. set(layer[get(posName)].x,0);
  366. );
  367. if(
  368. pos == 'left',
  369. add(all,lwidth,hwidth);
  370. div(dpx,all,2);
  371. add(lastPx,dpx,10);
  372. mul(lastPx, -1);
  373. set(layer[get(posName)].align,center);
  374. set(layer[get(posName)].x,get(lastPx));
  375. set(layer[get(posName)].y,0);
  376. );
  377. if(
  378. pos == 'right',
  379. add(all,lwidth,hwidth);
  380. div(dpx,all,2);
  381. add(lastPx,dpx,10);
  382. mul(lastPx, 1);
  383. set(layer[get(posName)].align,center);
  384. set(layer[get(posName)].x,get(lastPx));
  385. set(layer[get(posName)].y,0);
  386. );
  387. </action>
  388. <action name="removeJQHotspot">
  389. set(delHotspot,%1);
  390. removehotspot(%1,true);
  391. txtadd(delHotspotLabel,'tooltip_',get(delHotspot));
  392. txtadd(delHotspotdot,'tooldot_',get(delHotspot));
  393. removelayer(get(delHotspotLabel));
  394. removelayer(get(delHotspotdot));
  395. </action>
  396. <action name="cancelJQHotspot">
  397. <!-- set(canclHotspot,%1); -->
  398. <!-- crop_animation_r_stop(%1); -->
  399. </action>
  400. <!-- 编辑热点 -->
  401. <action name="editJQHotspot">
  402. set(hsp_name,%1);
  403. set(hsp_type,%2);
  404. set(dImage,'static/panoassets/images/hotspot/image_place_holder.png');
  405. txtadd(hsLabel, 'tooltip_', %1);
  406. txtadd(hsDot, 'tooldot_', %1);
  407. set(hotspot[get(hsp_name)].hotspottype,%2);
  408. set(hotspot[get(hsp_name)].keep,true);
  409. set(hotspot[get(hsp_name)].hotspottitle,%3);
  410. set(hotspot[get(hsp_name)].hotlink,%7);
  411. set(hotspot[get(hsp_name)].hoverstatus,%9);
  412. set(hotspot[get(hsp_name)].hotspotStyle,%10);
  413. copy(hotspot[get(hsp_name)].borderWidth,false);
  414. copy(layer[get(hsLabel)].borderWidth,false);
  415. copy(layer[get(hsDot)].borderWidth,false);
  416. set(hotspot[get(hsp_name)].background,false);
  417. txtsplit(%10,'|',fontSize,pos,isHover,borderColor,fillColor,textColor,isShowLine,isTextWrap,lineDirection,textDirection,textNumPerLine,duration,frameNumber,framewidth);
  418. 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;">',%3,'</div>
  419. </div>');
  420. copy(layer[get(hsLabel)].html, labelCode);
  421. copy(layer[get(hsLabel)].pos, pos);
  422. trace('editJQHotspot',%1,'::type::',%3);
  423. if(get(hsp_type) == 3,
  424. trace('edit3::',get(hsp_name));
  425. set(hotspot[get(hsp_name)].animatiedOn,0);
  426. copy(hotspot[get(hsp_name)].rotate,0);
  427. copy(layer[get(hsLabel)].rotate,0);
  428. set(hotspot[get(hsp_name)].type,"text");
  429. set(hotspot[get(hsp_name)].width,1);
  430. set(hotspot[get(hsp_name)].width,1);
  431. set(hotspot[get(hsp_name)].height,80);
  432. set(hotspot[get(hsp_name)].padding,0);
  433. txtadd(line,'<div style="background-color: ',get(borderColor),';width:1px;height:80px;"></div>');
  434. <!-- txtadd(dot,'<div style="background-color: ',get(borderColor),';width:10px;height:10px;"></div>'); -->
  435. copy(hotspot[get(hsp_name)].html,line);
  436. if(isShowLine == 1,
  437. set_label_dir(get(hsp_name),get(lineDirection),0);
  438. set_label_dir(get(hsLabel),get(lineDirection),1);
  439. set_label_dir(get(hsDot),get(lineDirection),2);
  440. );
  441. if(isShowLine == 0,
  442. set(hotspot[get(hsp_name)].width,0);
  443. set(layer[get(hsLabel)].x,0);
  444. set(layer[get(hsLabel)].y,0);
  445. set(layer[get(hsLabel)].rotate,0);
  446. set(hotspot[get(hsp_name)].visible,true);
  447. set(layer[get(hsLabel)].visible,true);
  448. set(layer[get(hsDot)].visible,false);
  449. );
  450. set(hotspot[get(hsp_name)].onhover,'');
  451. set(hotspot[get(hsp_name)].onout,'');
  452. );
  453. if(get(hsp_type) LE 2,
  454. trace('edit2::',get(hsp_name));
  455. txtadd(iconUrl,'',%4);
  456. txtreplace(iconUrl,'|',',');
  457. jsget(timestamp,'Date.now();');
  458. trace('iconUrl::',iconUrl);
  459. set(hotspot[get(hsp_name)].height,%8);
  460. set(hotspot[get(hsp_name)].width,%8);
  461. delayedcall(0.1,txtadd(tooltipname, 'tooltip_', get(hsp_name)); set_label_pos(get(tooltipname),get(layer[get(tooltipname)].pos)););
  462. indexoftxt(index, get(iconUrl), 'image_place_holder.png');
  463. if(get(index) GT -1,trace('place-holder');
  464. set(hotspot[get(hsp_name)].animatiedOn,0);
  465. trace('默认图::');
  466. delayedcall(0.2, set(hotspot[get(hsp_name)].crop,'0|0|204|204'););
  467. );
  468. ifnot(get(index) GT -1,trace('place-holder');set(hotspot[get(hsp_name)].animatiedOn,1););
  469. if(get(hsp_type) == 0,
  470. txtreplace(iconUrl,'.svg','.png');
  471. set(iconUrl,get(calc(iconUrl +'?'+ timestamp)));
  472. set(hotspot[get(hsp_name)].animatiedOn,1);
  473. set(hotspot[get(hsp_name)].framewidth,84);
  474. set(hotspot[get(hsp_name)].frameRate,calc( 1.0 / 60));
  475. set(hotspot[get(hsp_name)].xframes,1);
  476. set(hotspot[get(hsp_name)].yframes,40);
  477. );
  478. if(get(hsp_type) == 1,
  479. set(hotspot[get(hsp_name)].animatiedOn,0);
  480. );
  481. <!-- 序列化类型编辑 -->
  482. if(get(hsp_type) == 2,
  483. set(iconUrl,get(calc(iconUrl +'?'+ timestamp)));
  484. set(hotspot[get(hsp_name)].visible,true);
  485. calc(frameRate, duration / frameNumber);
  486. trace('frameRate::',get(frameRate));
  487. trace('frameNumber::',get(frameNumber));
  488. trace('framewidth::',get(framewidth));
  489. trace('duration::',get(duration));
  490. set(hotspot[get(hsp_name)].xframes, 1);
  491. if(!isNaN(frameRate) AND frameRate GT 0,
  492. set(hotspot[get(hsp_name)].frameRate,get(frameRate));
  493. );
  494. if(!isNaN(framewidth) AND framewidth GT 0,set(hotspot[get(hsp_name)].framewidth,get(framewidth)));
  495. if(!isNaN(frameNumber) AND frameNumber GT 0,
  496. set(hotspot[get(hsp_name)].frameNumber,get(frameNumber));
  497. set(hotspot[get(hsp_name)].yframes, get(frameNumber));
  498. );
  499. );
  500. set(hotspot[get(hsp_name)].url,get(iconUrl));
  501. set(hotspot[get(hsp_name)].rotate,0);
  502. set(layer[get(hsLabel)].rotate,0);
  503. copy(hoverstatus,hotspot[get(hsp_name)].hoverstatus);
  504. trace('edit-hoverstatus::',get(hoverstatus));
  505. if(hoverstatus == 0,
  506. set(layer[get(hsLabel)].visible,true);
  507. set(hotspot[get(hsp_name)].onhover,'');
  508. set(hotspot[get(hsp_name)].onout,'');
  509. );
  510. if(hoverstatus == 1,
  511. set(layer[get(hsLabel)].visible,false);
  512. set(hotspot[get(hsp_name)].onhover,'');
  513. set(hotspot[get(hsp_name)].onout,'');
  514. );
  515. if(hoverstatus == 2,
  516. set(layer[get(tooltipname)].visible,false);
  517. set(hotspot[get(hsp_name)].onhover,txtadd(tooltipname, 'tooltip_', get(hsp_name)); set(layer[get(tooltipname)].visible,true););
  518. set(hotspot[get(name)].onout,
  519. txtadd(tooltipname, 'tooltip_', get(hsp_name));
  520. set(layer[get(tooltipname)].visible,false);
  521. );
  522. );
  523. <!-- trace('last_edit::',hotspot[get(hsp_name)].onloaded); -->
  524. );
  525. </action>
  526. <action name="dragJQlayer">
  527. txtadd(hsName, '', get(name));
  528. txtreplace(hsName, 'tooltip_', '');
  529. txtreplace(hsName, 'tooldot_', '');
  530. <!-- copy(drag_currentx, x);
  531. copy(drag_currenty, y);
  532. copy(drag_stagex, mouse.stagex);
  533. copy(drag_stagey, mouse.stagey);
  534. indexoftxt(align_contains_right, get(align), 'right');
  535. indexoftxt(align_contains_bottom, get(align), 'bottom');
  536. calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
  537. calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);
  538. -->
  539. copy(hath, hotspot[get(hsName)].ath);
  540. copy(hatv, hotspot[get(hsName)].atv);
  541. spheretoscreen(hath, hatv, hotspotcenterx, hotspotcentery, 'l');
  542. sub(drag_adjustx,mouse.stagex, hotspotcenterx);
  543. sub(drag_adjusty,mouse.stagey, hotspotcentery);
  544. asyncloop(
  545. <!-- 计算热点中心点 -->
  546. pressed,
  547. sub(dx, mouse.stagex, drag_adjustx);
  548. sub(dy, mouse.stagey, drag_adjusty);
  549. screentosphere(dx, dy, ath, atv);
  550. <!-- 更新 -->
  551. copy(hotspot[get(hsName)].ath, ath);
  552. copy(hotspot[get(hsName)].atv, atv);,
  553. set(global.ath,get(ath));
  554. set(global.atv,get(atv));
  555. );
  556. </action>
  557. <action name='JQlayerClick'>
  558. txtadd(clickName, '', get(name));
  559. txtreplace(clickName, 'tooltip_', '');
  560. txtreplace(clickName, 'tooldot_', '');
  561. <!-- trace('JQlayerClick',get(clickName)); -->
  562. js(__krfn.utils.linkopen(get(hotlink),get(clickName)));
  563. </action>
  564. <action name="dragJQhotspot">
  565. trace('dragJQhotspot::',ath,atv);
  566. spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, 'l');
  567. sub(drag_adjustx,mouse.stagex, hotspotcenterx);
  568. sub(drag_adjusty,mouse.stagey, hotspotcentery);
  569. asyncloop(
  570. pressed,
  571. sub(dx, mouse.stagex, drag_adjustx);
  572. sub(dy, mouse.stagey, drag_adjusty);
  573. screentosphere(dx, dy, ath, atv);
  574. );
  575. </action>
  576. </krpano>