customTooltip.xml 29 KB

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