thumbbar.xml.backup-2021-02-01-09-39-53 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <!--
  2. krpano - a krpano xml controlled thumbnails image bar
  3. -->
  4. <krpano>
  5. <action name="gjthumbbar">
  6. create_thumbbar(get(gallery[%1].img.count), bottom, h, 0,10, calc(device.mobile ? 90 : 90), calc(device.mobile ? 120 : 120), calc(device.mobile ? 3 : 6), %1);
  7. for(set(i,0), i LT gallery[%1].img.count, inc(i),
  8. thumbbar_addimage('get(gallery[%1].img[get(i)].url)');
  9. );
  10. </action>
  11. <action name="create_thumbbar">
  12. trace( %0 %1);
  13. set(thumbbar_images, %1);
  14. set(thumbbar_align, %2);
  15. set(thumbbar_orientation, %3);
  16. set(thumbbar_x, %4);
  17. set(thumbbar_y, %5);
  18. set(thumbbar_thumbwidth, %6);
  19. set(thumbbar_thumbheight, %7);
  20. set(thumbbar_border, %8);
  21. set(thumbbar_image_index, 0);
  22. set(thimage, %9);
  23. set(thumbbar_xoffset, get(thumbbar_border) );
  24. set(thumbbar_yoffset, get(thumbbar_border) );
  25. set(thumbbar_xborder, 0);
  26. set(thumbbar_yborder, 0);
  27. if(thumbbar_orientation == h,
  28. add(thumbbar_yborder, thumbbar_y, thumbbar_thumbheight);
  29. add(thumbbar_yborder, thumbbar_yborder, thumbbar_border);
  30. add(thumbbar_yborder, thumbbar_yborder, thumbbar_border);
  31. add(thumbbar_yborder, thumbbar_yborder, thumbbar_border);
  32. mul(thumbbar_yborder, thumbbar_yborder, 2);
  33. mul(thumbbar_xborder, thumbbar_border, 2);
  34. if(%2 == left, set(thumbbar_yoffset,0); );
  35. if(%2 == right, set(thumbbar_yoffset,0); );
  36. if(%2 == top, mul(thumbbar_xoffset,thumbbar_border,0.5); );
  37. if(%2 == bottom, mul(thumbbar_xoffset,thumbbar_border,0.5); );
  38. if(%2 == center, mul(thumbbar_xoffset,thumbbar_border,0.5); set(thumbbar_yoffset,0); mul(thumbbar_yborder,thumbbar_border,2); );
  39. ,
  40. add(thumbbar_xborder, thumbbar_x, thumbbar_thumbwidth);
  41. add(thumbbar_xborder, thumbbar_xborder, thumbbar_border);
  42. add(thumbbar_xborder, thumbbar_xborder, thumbbar_border);
  43. add(thumbbar_xborder, thumbbar_xborder, thumbbar_border);
  44. mul(thumbbar_xborder, thumbbar_xborder, 2);
  45. mul(thumbbar_yborder, thumbbar_border, 2);
  46. if(%2 == left, mul(thumbbar_yoffset,thumbbar_border,0.5); );
  47. if(%2 == right, mul(thumbbar_yoffset,thumbbar_border,0.5); );
  48. if(%2 == top, set(thumbbar_xoffset,0); );
  49. if(%2 == bottom, set(thumbbar_xoffset,0); );
  50. if(%2 == center, set(thumbbar_xoffset,0); mul(thumbbar_yoffset,thumbbar_border,0.5); mul(thumbbar_xborder,thumbbar_border,2); );
  51. );
  52. addplugin(thumbbar);
  53. set(plugin[thumbbar].align, get(thumbbar_align));
  54. set(plugin[thumbbar].x, get(thumbbar_x));
  55. set(plugin[thumbbar].y, get(thumbbar_y));
  56. set(plugin[thumbbar].type, container);
  57. set(plugin[thumbbar].bgcolor, 0xFFFFFF);
  58. set(plugin[thumbbar].bgalpha, 0.5);
  59. set(plugin[thumbbar].zorder, 1);
  60. set(plugin[thumbbar].enabled, false);
  61. </action>
  62. <action name="thumbbar_addimage">
  63. trace(%0 %1);
  64. txtadd(pname, 'thumbbar_image_', get(thumbbar_image_index));
  65. addplugin(get(pname));
  66. set(plugin[%pname].zorder, 2);
  67. set(plugin[%pname].url, %1);
  68. set(plugin[%pname].align, get(thumbbar_align));
  69. set(plugin[%pname].width, get(thumbbar_thumbwidth));
  70. set(plugin[%pname].height, get(thumbbar_thumbheight));
  71. if (thumbbar_orientation == 'v',
  72. <!-- vertical thumbs -->
  73. add(plugin[%pname].x, thumbbar_x, thumbbar_xoffset);
  74. add(tmp, thumbbar_border, thumbbar_thumbheight);
  75. mul(tmp, tmp, thumbbar_image_index);
  76. add(tmp, tmp, thumbbar_yoffset);
  77. add(plugin[%pname].y, thumbbar_y, tmp );
  78. set(thumbbar_vcenter,false);
  79. if(thumbbar_align == left, set(thumbbar_vcenter,true));
  80. if(thumbbar_align == center, set(thumbbar_vcenter,true));
  81. if(thumbbar_align == right, set(thumbbar_vcenter,true));
  82. if(thumbbar_vcenter,
  83. add(tmp2, thumbbar_border, thumbbar_thumbheight);
  84. mul(tmp2, tmp2, thumbbar_images);
  85. mul(tmp2, tmp2, 0.5);
  86. sub(plugin[%pname].y, plugin[%pname].y, tmp2 );
  87. mul(tmp3, thumbbar_thumbheight, 0.5);
  88. add(plugin[%pname].y, plugin[%pname].y, tmp3 );
  89. );
  90. sub(tmp, tmp, thumbbar_yoffset);
  91. add(tmp, tmp, thumbbar_border);
  92. add(tmp, tmp, thumbbar_thumbheight);
  93. add(tmp, tmp, thumbbar_border);
  94. set(plugin[thumbbar].height, get(tmp));
  95. mul(tmp, thumbbar_border, 2);
  96. add(plugin[thumbbar].width, tmp, thumbbar_thumbwidth);
  97. ,
  98. <!-- horizontal thumbs -->
  99. add(plugin[%pname].y, thumbbar_y, thumbbar_yoffset);
  100. add(tmp, thumbbar_border, thumbbar_thumbwidth);
  101. mul(tmp, tmp, thumbbar_image_index);
  102. add(tmp, tmp, thumbbar_xoffset);
  103. add(plugin[%pname].x, thumbbar_x, tmp );
  104. set(thumbbar_hcenter,false);
  105. if(thumbbar_align == top, set(thumbbar_hcenter,true));
  106. if(thumbbar_align == center, set(thumbbar_hcenter,true));
  107. if(thumbbar_align == bottom, set(thumbbar_hcenter,true));
  108. if(thumbbar_hcenter,
  109. add(tmp2, thumbbar_border, thumbbar_thumbwidth);
  110. mul(tmp2, tmp2, thumbbar_images);
  111. mul(tmp2, tmp2, 0.5);
  112. sub(plugin[%pname].x, plugin[%pname].x, tmp2 );
  113. mul(tmp3, thumbbar_thumbwidth, 0.5);
  114. add(plugin[%pname].x, plugin[%pname].x, tmp3 );
  115. );
  116. sub(tmp, tmp, thumbbar_xoffset);
  117. add(tmp, tmp, thumbbar_border);
  118. add(tmp, tmp, thumbbar_thumbwidth);
  119. add(tmp, tmp, thumbbar_border);
  120. set(plugin[thumbbar].width, get(tmp));
  121. mul(tmp, thumbbar_border, 2);
  122. add(plugin[thumbbar].height, tmp, thumbbar_thumbheight);
  123. );
  124. copy(plugin[%pname].thumbx, plugin[%pname].x);
  125. copy(plugin[%pname].thumby, plugin[%pname].y);
  126. set(plugin[%pname].onclick, thumbbar_showimage(get(name)) );
  127. inc(thumbbar_image_index);
  128. </action>
  129. <!-- 关闭 -->
  130. <action name="hide_thumbbar">
  131. tween(layer[gclose].alpha, 0);
  132. thumbbar_set_visible(false);
  133. thumbbar_hide_allimages();
  134. </action>
  135. <!-- 大图 -->
  136. <action name="thumbbar_showimage">
  137. thumbbar_hide_allimages();
  138. set(pic_id,%1);
  139. set(plugin[%1].zorder, 3);
  140. push(plugin[%1].width);
  141. push(plugin[%1].height);
  142. plugin[%1].resetsize();
  143. copy(plugin[%1].originalwidth, plugin[%1].width);
  144. copy(plugin[%1].originalheight, plugin[%1].height);
  145. pop(plugin[%1].height);
  146. pop(plugin[%1].width);
  147. set(imgwidth, get(plugin[%1].originalwidth));
  148. set(imgheight, get(plugin[%1].originalheight));
  149. set(maxwidth, get(stagewidth));
  150. sub(maxwidth, maxwidth, thumbbar_xborder);
  151. set(maxheight, get(stageheight));
  152. sub(maxheight, maxheight, thumbbar_yborder);
  153. if(imgwidth GT maxwidth,
  154. mul(imgheight, imgheight, maxwidth);
  155. div(imgheight, imgheight, imgwidth);
  156. copy(imgwidth, maxwidth);
  157. );
  158. if(imgheight GT maxheight,
  159. mul(imgwidth, imgwidth, maxheight);
  160. div(imgwidth, imgwidth, imgheight);
  161. copy(imgheight, maxheight);
  162. );
  163. tween(plugin[%1].width, get(imgwidth));
  164. tween(plugin[%1].height, get(imgheight));
  165. mul(tmp, thumbbar_border, 3);
  166. add(tmp, tmp, thumbbar_thumbwidth);
  167. plugin[%1].changeorigin(center,center);
  168. tween(plugin[%1].x, 0);
  169. tween(plugin[%1].y, 0);
  170. <!-- js(calc('console.log(" '+%1+' ")')); -->
  171. jscall(calc('console.log("%1")'));
  172. js(calc('thllery("'+thimage+'","'+pic_id+'")'));
  173. trace(%pname %1);
  174. set(plugin[%1].onclick, thumbbar_hideimage(%1) );
  175. </action>
  176. <!-- 关闭 -->
  177. <action name="thumbbar_hideimage">
  178. plugin[%1].changeorigin(get(thumbbar_align),get(thumbbar_align));
  179. set(plugin[%1].zorder, 2);
  180. tween(plugin[%1].width, get(thumbbar_thumbwidth));
  181. tween(plugin[%1].height, get(thumbbar_thumbheight));
  182. tween(plugin[%1].x, get(plugin[%1].thumbx));
  183. tween(plugin[%1].y, get(plugin[%1].thumby));
  184. set(plugin[%1].onclick, thumbbar_showimage(%1) );
  185. </action>
  186. <action name="thumbbar_hide_allimages">
  187. if(%1 != NEXT, set(i,0));
  188. txtadd(pname, 'thumbbar_image_', get(i));
  189. thumbbar_hideimage(get(pname));
  190. inc(i);
  191. if(i LT thumbbar_images, thumbbar_hide_allimages(NEXT));
  192. </action>
  193. <action name="thumbbar_set_visible">
  194. if(%2 != NEXT, set(i,0));
  195. txtadd(pname, 'thumbbar_image_', get(i));
  196. set(plugin[get(pname)].visible,%1);
  197. <!-- jscall(toggleBtns(true)); -->
  198. inc(i);
  199. if(i LT thumbbar_images, thumbbar_set_visible(%1,NEXT), set(plugin[thumbbar].visible,%1));
  200. </action>
  201. </krpano>