combobox.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <krpano>
  2. <!--
  3. krpano 1.20.9 combobox.xml Plugin
  4. https://krpano.com/plugins/combobox/
  5. - This plugin converts <combobox> elements in the current xml
  6. into <layer> container, scrollarea and textfield elements.
  7. - Additionally it's also possible to add and remove combobox
  8. elements also dynamically.
  9. - The full xml implementation allows many ways of customizing
  10. for own needs - custom designs/styles, custom functionality.
  11. - The plugin works automatically the same for HTML5 and Flash.
  12. - It's possible to use this plugin as replacement for the old
  13. combobox.swf/combobox.js plugins, the action interfaces are
  14. the same.
  15. Syntax for Static XML Code:
  16. <combobox name="..." design="..." ...any layer settings...>
  17. <item name="..." caption="..." onclick="..." />
  18. <item name="..." caption="..." onclick="..." />
  19. </combobox>
  20. Syntax for Dynamic XML Code:
  21. - Global Actions:
  22. addComboboxLayer(cbname, design*)
  23. removeComboboxLayer(cbname);
  24. - Combobox Layer Actions:
  25. layer[cbname].addItem(caption, onclick)
  26. layer[cbname].addNamedItem(name, caption, onclick)
  27. layer[cbname].addIdItem(name, caption, onclick); same as addNamedItem (for combobox.js compatibility)
  28. layer[cbname].selectItem(caption)
  29. layer[cbname].selectItemByName(name_or_index)
  30. layer[cbname].selectIdItem(name_or_index) same as selectItemByName (for combobox.js compatibility)
  31. layer[cbname].removeAll()
  32. layer[cbname].openList()
  33. layer[cbname].closeList()
  34. - Events/Callbacks:
  35. layer[cbname].onChange
  36. - Combobox Layer Attributes:
  37. layer[cbname].item - krpano Array of the items
  38. layer[cbname].selecteditemindex - current selected item index
  39. -->
  40. <!-- path to the scrollarea plugin -->
  41. <combobox_scrollareaplugin
  42. url.html5="%VIEWER%/plugins/scrollarea.js"
  43. url.flash="%VIEWER%/plugins/scrollarea.swf"
  44. />
  45. <!-- core internal layer styles -->
  46. <style name="combobox_container_style" type="container" maskchildren="true" bgcapture="true" visible="false" onclick="combobox_onclick_event();" mergedalpha="false" alpha="1.0" />
  47. <style name="combobox_marker_style" type="text" align="righttop" edge="center" html="▼" havemarkersize="false" onautosized="set(havemarkersize,true);" mergedalpha="false" alpha="1.0" />
  48. <style name="combobox_item_style" type="text" wordwrap="false" vcenter="true" align="lefttop" onover="if(!combbox_item_pressed,onoveritem());asyncloop(hovering,,if(!combbox_item_pressed,onoutitem()));" ondown="onoveritem(); set(combbox_item_pressed,true);" onup="onoutitem(); set(combbox_item_pressed,false);" onoveritem="set(bg,true);" onoutitem="set(bg,false);" mergedalpha="false" alpha="1.0" />
  49. <!-- several pre-defined designs -->
  50. <combobox_design name="default" margin="2" open_close_speed="0.25">
  51. <!-- default design - white box with black text and blue selection -->
  52. <style name="combobox_container_style" bgalpha="1.0" bgcolor="0xFFFFFF" bgborder="1 0xFFFFFF 0.5" bgroundedge="1" bgshadow="0 1 3 0x000000 1.0" />
  53. <style name="combobox_marker_style" css="color:#FFFFFF;" bg="false" txtshadow="0 0 2 0x000000 1" />
  54. <style name="combobox_item_style" css="color:#222222;" padding="4 4" bg="false" bgcolor="0xC7E4FC" bgalpha="1.0" bgroundedge="1" txtshadow="0 0 1 0xFFFFFF 1.0" />
  55. </combobox_design>
  56. <combobox_design name="vtour" margin="4" open_close_speed="0.25">
  57. <!-- default vtourskin.xml design -->
  58. <style name="combobox_container_style" bgalpha="0.8" bgcolor="0x2D3E50" bgborder="0" bgroundedge="1" bgshadow="0 4 10 0x000000 0.3" />
  59. <style name="combobox_marker_style" css="color:#FFFFFF;" bg="false" txtshadow="0 0 2 0x000000 1" />
  60. <style name="combobox_item_style" css="color:#FFFFFF;" padding="4 4" bg="false" bgcolor="0xFFFFFF" bgalpha="0.5" bgroundedge="0" txtshadow="0 0 2 0x000000 1" />
  61. </combobox_design>
  62. <!-- internal events -->
  63. <events name="combobox_xml_plugin_events" keep="true"
  64. onresize="combobox_closelist();"
  65. />
  66. <!-- krpano version check -->
  67. <action name="combobox_versioncheck" autorun="preinit">
  68. if(build LT '2020-11-01',
  69. error('combobox.xml - too old krpano version!');
  70. set(events[combobox_xml_plugin_events].name, null);
  71. set(action[addComboboxLayer].content, '');
  72. set(action[removeComboboxLayer].content, '');
  73. ,
  74. combobox_xml_init();
  75. );
  76. </action>
  77. <action name="combobox_xml_init">
  78. <!-- set auto call again on next xml load -->
  79. set(action[combobox_xml_init].autorun, onload);
  80. combobox_parse_xml_elements();
  81. </action>
  82. <!-- convert all <combobox> elements to layers -->
  83. <action name="combobox_parse_xml_elements" scope="localonly">
  84. if(global.combobox,
  85. copy(combobox_src, global.combobox);
  86. delete(global.combobox);
  87. def(i, integer, 0);
  88. def(cnt, integer, get(combobox_src.count));
  89. if(cnt GT 0, loop(i LT cnt,
  90. copy(cb, combobox_src[get(i)]);
  91. if(cb AND cb.name AND cb.parsed != true,
  92. set(cb.parsed, true);
  93. addComboboxLayer(get(cb.name), get(cb.design));
  94. copy(ly, global.layer[get(cb.name)]);
  95. copyattributes(get(ly), get(cb));
  96. set(ly.keep, true);
  97. def(item_cnt, integer, get(cb.item.count));
  98. if(item_cnt GT 0,
  99. def(item_i, integer, 0);
  100. loop(item_i LT item_cnt,
  101. combobox_additem(get(ly.name), get(cb.item[get(item_i)].name), get(cb.item[get(item_i)].caption), get(cb.item[get(item_i)].onclick), get(cb.item[get(item_i)].oninit));
  102. inc(item_i);
  103. );
  104. );
  105. );
  106. inc(i);
  107. ));
  108. );
  109. </action>
  110. <!-- dynamically add a combobox layer -->
  111. <action name="addComboboxLayer" scope="localonly" args="cbname, design">
  112. <!-- create the layer -->
  113. addlayer(get(cbname));
  114. copy(cb, global.layer[get(cbname)]);
  115. set(cb.keep, true);
  116. <!-- copy the design settings (or set defaults) -->
  117. if(!global.combobox_design[get(design)].name, set(design,'default'));
  118. copy(cb.cbdesign, global.combobox_design[get(design)]);
  119. calc(cb.margin, cb.cbdesign.margin !== null ? cb.cbdesign.margin : 2);
  120. calc(cb.open_close_speed, cb.cbdesign.open_close_speed !== null ? cb.cbdesign.open_close_speed : 0.25);
  121. <!-- load the styles and copy the design style settings -->
  122. cb.loadstyle(combobox_container_style);
  123. copyattributes(get(cb), get(cb.cbdesign.style[combobox_container_style]));
  124. <!-- add/build/map actions -->
  125. calc(cb.addItem, 'combobox_additem(' + cbname + ', null, "%%1", "%%2");');
  126. calc(cb.addNamedItem, 'combobox_additem(' + cbname + ', "%%1", "%%2", "%%3");');
  127. calc(cb.addIdItem, 'combobox_additem(' + cbname + ', "%%1", "%%2", "%%3");');
  128. calc(cb.selectItem, 'combobox_finditem(' + cbname + ', "%%1", __cb_fi); if(__cb_fi GE 0, combobox_selectitem(' + cbname + ', get(__cb_fi))); delete(__cb_fi);');
  129. calc(cb.selectItemByName, 'combobox_selectitem(' + cbname + ', "%%1");');
  130. calc(cb.selectIdItem, 'combobox_selectitem(' + cbname + ', "%%1");');
  131. calc(cb.removeAll, 'combobox_removeitems(' + cbname + ');');
  132. calc(cb.openList, 'combobox_openlist(' + cbname + ');');
  133. calc(cb.closeList, 'combobox_closelist(' + cbname + ');');
  134. <!-- create sub-layers -->
  135. calc(saname, 'combobox_' + cbname + '_scrollarea');
  136. addlayer(get(saname));
  137. copy(sa, global.layer[get(saname)]);
  138. copy(sa.parent, cbname);
  139. copy(sa.url, global.combobox_scrollareaplugin.url);
  140. copy(sa.keep, true);
  141. copy(sa.align, lefttop);
  142. set(sa.direction, v);
  143. set(sa.enabled, false);
  144. set(sa.width, 100%);
  145. set(sa.height, 100%);
  146. copy(cb.scrollarea, sa);
  147. calc(mkname, 'combobox_' + cbname + '_marker');
  148. addlayer(get(mkname));
  149. copy(mk, global.layer[get(mkname)]);
  150. copy(mk.parent, saname);
  151. copy(mk.keep, true);
  152. mk.loadstyle(combobox_marker_style);
  153. copyattributes(get(mk), get(cb.cbdesign.style[combobox_marker_style]));
  154. copy(cb.marker, mk);
  155. <!-- item data array -->
  156. cb.createarray('item');
  157. <!-- item autosizing information -->
  158. set(cb.autosize_i, 0);
  159. set(cb.autosize_cnt, 0);
  160. set(cb.autosize_max_w, 0);
  161. set(cb.autosize_max_h, 0);
  162. set(cb.lastselecteditemindex, 0);
  163. set(cb.selecteditemindex, 0);
  164. </action>
  165. <!-- dynamically remove a combobox element -->
  166. <action name="removeComboboxLayer" scope="localonly" args="cbname">
  167. if(global.layer[get(cbname)],
  168. copy(cb, global.layer[get(cbname)]);
  169. if(cb === global.openedcombobox, delete(global.openedcombobox));
  170. if(cb,
  171. removelayer(get(cbname), true);
  172. );
  173. );
  174. </action>
  175. <!-- default onclick event for combobox elements: open the list -->
  176. <action name="combobox_onclick_event">
  177. combobox_openlist(get(name));
  178. </action>
  179. <!-- dynamically add items -->
  180. <action name="combobox_additem" scope="localonly" args="cbname, itemname, itemcaption, itemonclick, itemoninit">
  181. copy(cb, global.layer[get(cbname)]);
  182. <!-- when no item name is set, generate an automatic one -->
  183. if(itemname === null, calc(itemname, 'autoname_' + cb.item.count); );
  184. <!-- save the item caption and onclick event -->
  185. copy(cb.item[get(itemname)].caption, itemcaption);
  186. copy(cb.item[get(itemname)].onclick, itemonclick);
  187. inc(cb.autosize_cnt);
  188. <!-- create the item layer/textfield -->
  189. calc(itemlayername, 'comboboxitem_' + cbname + '_' + itemname);
  190. addlayer(get(itemlayername));
  191. copy(li, global.layer[get(itemlayername)]);
  192. li.loadstyle(combobox_item_style);
  193. copyattributes(get(li), get(cb.cbdesign.style[combobox_item_style]));
  194. copy(li.parent, cb.scrollarea.name);
  195. copy(li.keep, true);
  196. copy(li.cblayername, cb.name);
  197. copy(li.itemname, itemname);
  198. copy(li.html, itemcaption);
  199. set(li.onautosized, delayedcall(0,combobox_item_autosize_update()) );
  200. set(li.onclick, combobox_item_onclick() );
  201. if (isset(itemoninit), callwith(li, itemoninit));
  202. copy(cb.item[get(itemname)].itemlayername, itemlayername);
  203. copy(cb.item[get(itemname)].itemlayer, li);
  204. </action>
  205. <!-- onautosized callback from the item textfield -->
  206. <action name="combobox_item_autosize_update" scope="localonly">
  207. copy(cb, global.layer[get(caller.cblayername)]);
  208. inc(cb.autosize_i);
  209. Math.max(cb.autosize_max_w, caller.width);
  210. Math.max(cb.autosize_max_h, caller.height);
  211. if(cb.autosize_i == cb.autosize_cnt, combobox_align_items(get(cb.name)); );
  212. </action>
  213. <!-- align the image and set the combobox size -->
  214. <action name="combobox_align_items" scope="localonly" args="cbname">
  215. copy(cb, global.layer[get(cbname)]);
  216. if(cb.marker.havemarkersize == false OR cb.scrollarea.loaded == false,
  217. <!-- wait until everything is ready -->
  218. delayedcall(calc(cb.name + '_waitformarkersize'), 0.01, combobox_align_items(get(cbname)) );
  219. ,
  220. <!-- set the item positions and the combobox size -->
  221. if(global.openedcombobox === cb, combobox_closelist() );
  222. copy(sa, cb.scrollarea);
  223. calc(itemwidth, cb.margin GT 0 ? -2 * cb.margin : '100%');
  224. copy(mk_w, cb.marker.width);
  225. copy(item_cnt, cb.autosize_cnt);
  226. for(def(item_i, integer, 0), item_i LT item_cnt, inc(item_i),
  227. copy(li, global.layer[get(cb.item[get(item_i)].itemlayername)]);
  228. set(li.x, get(cb.margin));
  229. copy(li.width, itemwidth);
  230. copy(li.height, cb.autosize_max_h);
  231. calc(li.y, cb.margin + item_i * (cb.autosize_max_h + cb.margin));
  232. );
  233. if(cb.width == null OR cb.width == cb.lastautosizedwidth,
  234. <!-- no combobox width (or an autosized width) set - set the largest item width -->
  235. calc(cb.width, cb.margin + cb.autosize_max_w + 2 + mk_w + cb.margin);
  236. copy(cb.lastautosizedwidth, cb.width);
  237. );
  238. calc(cb.height, 2*cb.margin + cb.autosize_max_h);
  239. calc(sa.height, cb.margin + item_cnt*(cb.margin+cb.autosize_max_h));
  240. calc(sa.y, -(cb.selecteditemindex * (cb.autosize_max_h + cb.margin)));
  241. calc(cb.marker.x, cb.margin + mk_w/2);
  242. tween(global.layer[get(cb.name)].marker.y, calc(cb.margin + cb.selecteditemindex*(cb.autosize_max_h + cb.margin) + cb.autosize_max_h/2), 0.1);
  243. <!-- when all is done, show the combobox -->
  244. delayedcall(0.1, set(global.layer[get(cb.name)].visible,true); );
  245. );
  246. </action>
  247. <!-- helper action for calling a plugin event-code with 'global' and 'caller' scope -->
  248. <action name="combobox_do_event_call" scope="local" args="cb, eventcode">
  249. if(eventcode !== null, callwith(cb, get(eventcode) ); );
  250. </action>
  251. <!-- default onclick event for items: select the current item, close the list and call the item onclick event -->
  252. <action name="combobox_item_onclick" scope="localonly">
  253. copy(cb, global.layer[get(caller.cblayername)]);
  254. copy(itemname, caller.itemname);
  255. combobox_selectitem(get(cb.name), get(itemname));
  256. if(global.openedcombobox === cb, combobox_closelist() );
  257. if(cb.item[get(itemname)].onclick,
  258. if(cb.callonclickafterclose === false,
  259. <!-- call instantly -->
  260. combobox_do_event_call(get(cb), get(cb.item[get(itemname)].onclick));
  261. ,
  262. <!-- call the onclick event after the combobox has closed -->
  263. delayedcall(get(cb.open_close_speed),
  264. copy(cb.curitem, cb.item[get(itemname)]);
  265. combobox_do_event_call(get(cb), get(cb.item[get(itemname)].onclick));
  266. );
  267. );
  268. );
  269. </action>
  270. <!-- select an item -->
  271. <action name="combobox_selectitem" scope="localonly" args="cbname, itemname">
  272. if(global.combbox_item_pressed != true,
  273. copy(cb, global.layer[get(cbname)]);
  274. copy(cb.lastselecteditemindex, cb.selecteditemindex);
  275. copy(cb.selecteditemindex, cb.item[get(itemname)].index);
  276. <!-- call onchange event on selection change -->
  277. if(cb.lastselecteditemindex != cb.selecteditemindex AND cb.onchange,
  278. combobox_do_event_call(get(cb), get(cb.onchange));
  279. );
  280. if(global.openedcombobox === cb,
  281. <!-- when opened, just close to the selected item -->
  282. combobox_closelist();
  283. ,
  284. if(global.layer[get(cbname)].scrollarea.loaded,
  285. global.layer[get(cbname)].scrollarea.stopscrolling();
  286. calc(offset, cb.selecteditemindex*(cb.autosize_max_h + cb.margin));
  287. tween(global.layer[get(cbname)].marker.y, calc(cb.margin + offset + cb.autosize_max_h/2), 0);
  288. tween(global.layer[get(cbname)].scrollarea.y, calc(-offset), 0, default, global.layer[get(cbname)].scrollarea.update(); );
  289. );
  290. );
  291. );
  292. </action>
  293. <!-- find an item by its caption, the global variable defined in 'returnvariable' will contain the index -->
  294. <action name="combobox_finditem" scope="localonly" args="cbname, itemcaption, returnvariable">
  295. copy(cb, global.layer[get(cbname)]);
  296. copy(item_cnt, cb.item.count);
  297. set(calc('global.' + returnvariable), -1);
  298. for(def(item_i, integer, 0), item_i LT item_cnt, inc(item_i),
  299. if(cb.item[get(item_i)].caption == itemcaption,
  300. copy(calc('global.' + returnvariable), item_i);
  301. copy(item_i, item_cnt);
  302. );
  303. );
  304. </action>
  305. <!-- remove all items (to be able to add new ones) -->
  306. <action name="combobox_removeitems" scope="localonly" args="cbname">
  307. copy(cb, global.layer[get(cbname)]);
  308. if(global.openedcombobox === cb, combobox_closelist() );
  309. <!-- remove all item layers -->
  310. calc(item_i, cb.item.count - 1);
  311. loop(item_i GE 0,
  312. removelayer(get(cb.item[get(item_i)].itemlayername));
  313. dec(item_i);
  314. );
  315. <!-- reset the item information -->
  316. set(cb.item.count, 0);
  317. set(cb.autosize_i,0);
  318. set(cb.autosize_cnt, 0);
  319. set(cb.autosize_max_w, 0);
  320. set(cb.autosize_max_h, 0);
  321. set(cb.selecteditemindex, 0);
  322. set(cb.lastselecteditemindex, 0);
  323. if(cb.width == cb.lastautosizedwidth, set(cb.width, null));
  324. </action>
  325. <!-- open the combobox list -->
  326. <action name="combobox_openlist" scope="localonly" args="cbname">
  327. <!-- if another combobox is already open, close that one first -->
  328. if(global.openedcombobox !== null, combobox_closelist() );
  329. copy(cb, global.layer[get(cbname)]);
  330. copy(global.openedcombobox, cb);
  331. <!-- move to top -->
  332. copy(cb.backupzorder, cb.zorder);
  333. set(cb.zorder, 999);
  334. <!-- find the available screen space above or below the combobox -->
  335. calc(cbheight, 2*cb.margin + cb.autosize_max_h);
  336. set(lx1, 0);
  337. set(ly1, 0);
  338. copy(lx2, cb.pixelwidth);
  339. copy(ly2, cbheight);
  340. layertoscreen(get(cbname), lx1,ly1, lx1,ly1);
  341. layertoscreen(get(cbname), lx2,ly2, lx2,ly2);
  342. calc(space_above, ly1 - global.area.pixely);
  343. calc(space_below, global.area.pixelheight - (ly2 - global.area.pixely));
  344. <!-- the required space for full opening: -->
  345. calc(openheight, cb.margin + cb.autosize_cnt*(cb.margin+cb.autosize_max_h) );
  346. <!-- vertical centered alignment? -->
  347. calc(cb_edge, cb.edge ? cb.edge : cb.align);
  348. calc(iscentered, cb_edge == 'left' OR cb_edge == 'center' OR cb_edge == 'right');
  349. if(iscentered,
  350. calc(openheight_max, space_above + space_below);
  351. ,
  352. Math.max(openheight_max, space_above, space_below);
  353. );
  354. <!-- limit the height to the available space (minus some margin) -->
  355. Math.min(openheight, calc(openheight_max + cbheight - 20));
  356. <!-- need vertical offset? (depending on the available space and the align/edge setting) -->
  357. set(yoffset, null);
  358. calc(top_overflow, -ly1 + global.area.pixely + openheight/2);
  359. calc(bottom_overflow, ly2 - global.area.pixely + openheight/2 - global.area.pixelheight);
  360. if(cb.parent,
  361. <!-- no vertical offset inside other layers, do only a height clipping -->
  362. Math.max(max_overflow, top_overflow, bottom_overflow, 0);
  363. sub(openheight, max_overflow);
  364. ,
  365. if(iscentered,
  366. if(openheight GE (global.area.pixelheight - 20),
  367. set(yoffset,0);
  368. ,
  369. if(top_overflow GT 0, calc(yoffset, cb.y + top_overflow); );
  370. if(bottom_overflow GT 0, calc(yoffset, cb.y - bottom_overflow); );
  371. );
  372. ,
  373. indexoftxt(isbottomalign, get(cb_edge), 'bottom');
  374. if(space_above GT space_below,
  375. if(isbottomalign LT 0, calc(yoffset, cb.y - openheight + cbheight); );
  376. ,
  377. if(isbottomalign GE 0, calc(yoffset, cb.y - openheight + cbheight); );
  378. );
  379. );
  380. );
  381. if(yoffset != null,
  382. copy(cb.ybackup, cb.y);
  383. tween(global.layer[get(cbname)].y, calc(yoffset), get(cb.open_close_speed));
  384. );
  385. <!-- center the opened list at the selected item -->
  386. calc(centeritem_y, -1 * (cb.margin + cb.selecteditemindex*(cb.margin+cb.autosize_max_h) + cb.autosize_max_h/2 - openheight/2));
  387. clamp(centeritem_y, calc(openheight - cb.scrollarea.height), 0);
  388. <!-- apply the changes now -->
  389. tween(global.layer[get(cbname)].height, get(openheight), get(cb.open_close_speed));
  390. tween(global.layer[get(cbname)].scrollarea.y, get(centeritem_y), get(cb.open_close_speed), default, global.layer[get(cbname)].scrollarea.update(); );
  391. <!-- special html5/flash case:
  392. rotating textfields (the marker symbol here) are not possible in
  393. flash (a flashplayer limitation), so use a rotated symbol instead.
  394. -->
  395. if(global.device.html5,
  396. tween(global.layer[get(cbname)].marker.rotate, 90, get(cb.open_close_speed));
  397. ,
  398. set(global.layer[get(cbname)].marker.html, '◀');
  399. );
  400. <!-- enable the scrollarea to allow the user to drag it -->
  401. set(cb.scrollarea.enabled, true);
  402. <!-- install a global onmousedown event to close the list when clicking at the pano -->
  403. set(global.events[combobox_xml_plugin_events].onmousedown, combobox_closelist() );
  404. </action>
  405. <!-- close the current open list -->
  406. <action name="combobox_closelist" scope="localonly">
  407. if(global.openedcombobox !== null,
  408. copy(cb, global.openedcombobox);
  409. delete(global.openedcombobox);
  410. <!-- restore zorder -->
  411. copy(cb.zorder, cb.backupzorder);
  412. <!-- clear the global onmousedown event -->
  413. set(global.events[combobox_xml_plugin_events].onmousedown, null);
  414. <!-- disable the dragging -->
  415. set(cb.scrollarea.enabled, false);
  416. <!-- closing animations -->
  417. calc(offset, cb.selecteditemindex*(cb.autosize_max_h + cb.margin));
  418. if(cb.ybackup !== null, tween(cb.y, get(cb.ybackup), get(cb.open_close_speed)));
  419. global.layer[get(cb.name)].scrollarea.stopscrolling();
  420. tween(global.layer[get(cb.name)].height, calc(2*cb.margin + cb.autosize_max_h), get(cb.open_close_speed));
  421. tween(global.layer[get(cb.name)].scrollarea.y, calc(-offset), get(cb.open_close_speed), default, global.layer[get(cb.name)].scrollarea.update(); );
  422. tween(global.layer[get(cb.name)].marker.y, calc(cb.margin + offset + cb.autosize_max_h/2), get(cb.open_close_speed));
  423. <!-- special html5/flash case: rotate marker or change symbol -->
  424. if(global.device.html5,
  425. tween(global.layer[get(cb.name)].marker.rotate, 0, get(cb.open_close_speed));
  426. ,
  427. set(global.layer[get(cb.name)].marker.html, '▼');
  428. );
  429. );
  430. </action>
  431. </krpano>