tooltip.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <krpano>
  3. <plugin name="abs" keep="true" url="abs.swf" alturl="abs.js"/>
  4. <settings name="tooltip" oy="0" visible="true"/>
  5. <events name="tooltip" keep="true" onxmlcomplete=" set_tooltip_style(default_tooltip_style); reset_tooltip_style(); "/>
  6. <style name="default_tooltip_style" font_family="sans-serif" font_size="13" font_weight="normal" font_color="FFFFFF" embeddedfonts="false" padding="6 8" roundedge="10" background="true" backgroundcolor="0x000000" backgroundalpha="1" border="false" bordercolor="0x000000" borderalpha="1.0" borderwidth="1.0" shadow="0.0" shadowrange="4.0" shadowangle="45" shadowcolor="0x000000" shadowalpha="0" textshadow="0.0" textshadowrange="4.0" textshadowangle="45" textshadowcolor="0x000000" textshadowalpha="1.0" css=""/>
  7. <layer name="tooltip" keep="true" url="textfield.swf" align="lefttop" edge="bottom" x="0" y="0" oy="0" zorder="9998" alpha=".5" enabled="false" visible="false" handcursor="false" embeddedfonts="true" autowidth="true" autoheight="true" vcenter="true" html="." onloaded="" onautosized="sub(height_error, pixelheight, height);add(oy, height_error);"/>
  8. <layer name="tooltip_arrow" type="container" keep="true" enabled="false" visible="false" align="lefttop" edge="bottom" x="0" y="0" ox="0" oy="0" width="8" height="8" scalechildren="true" maskchildren="true" zorder="9999" background="true" bgalpha="0" bgcolor="0xaa2266">
  9. <layer name="tooltip_arrow_square" url="textfield.swf" enabled="false" keep="true" align="center" edge="center" x="0" y="-8" width="10" height="10" rotate="45" zorder="999"/>
  10. </layer>
  11. <style name="tooltip" onloaded="setup_tooltip(get(name));"/>
  12. <action name="reset_tooltip_style">if(settings[tooltip].style, set_tooltip_style(get(settings[tooltip].style)); , set_tooltip_style(default_tooltip_style); );</action>
  13. <action name="set_tooltip_style">
  14. if(layer[tooltip].style != %1, set(layer[tooltip].style, %1);
  15. ifnot(style[%1].generated, set(style[%1].generated, true);
  16. set(style[%1].css, '');
  17. <!--if(device.pixelratio GT 1,-->
  18. <!--set(layer[tooltip_arrow].scale, 2);-->
  19. <!--mul(style[%1].roundedge, 2);-->
  20. <!--mul(style[%1].font_size, 2);-->
  21. <!--if(style[%1].padding_2x, copy(style[%1].padding, style[%1].padding_2x);-->
  22. <!--,-->
  23. <!--set(style[%1].padding_2x, '');-->
  24. <!--mul_padding(%1, 0);-->
  25. <!--copy(style[%1].padding, style[%1].padding_2x);-->
  26. <!--);-->
  27. <!--);-->
  28. txtadd(color, 'color:#', get(style[%1].font_color), '; ');
  29. txtadd(font_family, 'font-family:', get(style[%1].font_family), '; ');
  30. txtadd(font_size, 'font-size:', get(style[%1].font_size), 'px; ');
  31. txtadd(font_weight, 'font-weight:', get(style[%1].font_weight), '; ');
  32. if(device.html5,
  33. if(style[%1].html5_font_family,
  34. txtadd(font_family, 'font-family:', get(style[%1].html5_font_family), '; ');
  35. );
  36. );
  37. txtadd(style[%1].css, get(color));
  38. txtadd(style[%1].css, get(font_family));
  39. txtadd(style[%1].css, get(font_size));
  40. txtadd(style[%1].css, get(font_weight));
  41. );
  42. copy_style(tooltip, %1);
  43. copy_style(tooltip_arrow_square, %1);
  44. set(layer[tooltip_arrow_square].roundedge, 0); );</action>
  45. <action name="copy_style">copy(layer[%1].css, style[%2].css); copy(layer[%1].embeddedfonts, style[%2].embeddedfonts); copy(layer[%1].padding, style[%2].padding); copy(layer[%1].padding_2x, style[%2].padding_2x); copy(layer[%1].roundedge, style[%2].roundedge); copy(layer[%1].background, style[%2].background); copy(layer[%1].backgroundcolor, style[%2].backgroundcolor); copy(layer[%1].backgroundalpha, style[%2].backgroundalpha); copy(layer[%1].border, style[%2].border); copy(layer[%1].bordercolor, style[%2].bordercolor); copy(layer[%1].borderalpha, style[%2].borderalpha); copy(layer[%1].borderwidth, style[%2].borderwidth); copy(layer[%1].shadow, style[%2].shadow); copy(layer[%1].shadowrange, style[%2].shadowrange); copy(layer[%1].shadowangle, style[%2].shadowangle); copy(layer[%1].shadowcolor, style[%2].shadowcolor); copy(layer[%1].shadowalpha, style[%2].shadowalpha); copy(layer[%1].textshadow, style[%2].textshadow); copy(layer[%1].textshadowrange, style[%2].textshadowrange); copy(layer[%1].textshadowangle, style[%2].textshadowangle); copy(layer[%1].textshadowcolor, style[%2].textshadowcolor); copy(layer[%1].textshadowalpha, style[%2].textshadowalpha);</action>
  46. <action name="setup_tooltip">
  47. if (ath !== null,
  48. ifnot(hotspot[%1].tooltip_oy,
  49. set(hotspot[%1].tooltip_oy, 000);
  50. );
  51. ifnot(hotspot[%1].tooltip,
  52. set(hotspot[%1].tooltip, '');
  53. );
  54. ifnot(hotspot[%1].edge,
  55. set(hotspot[%1].edge, center);
  56. );
  57. if(hotspot[%1].edge == center,
  58. copy(new_tooltip_oy, hotspot[%1].height);
  59. div(new_tooltip_oy, 2);
  60. mul(new_tooltip_oy, -1);
  61. add(hotspot[%1].tooltip_oy, new_tooltip_oy);
  62. );
  63. if(device.touchdevice,
  64. ifnot(hotspot[%1].ondown,
  65. set(hotspot[%1].ondown, '')
  66. );
  67. ifnot(hotspot[%1].onup,
  68. set(hotspot[%1].onup, '')
  69. );
  70. txtadd(hotspot[%1].ondown, 'show_tooltip();');
  71. txtadd(hotspot[%1].onup, 'hide_tooltip();');
  72. ,
  73. ifnot(hotspot[%1].onover, set(hotspot[%1].onover, ''));
  74. ifnot(hotspot[%1].onout, set(hotspot[%1].onout, ''));
  75. txtadd(hotspot[%1].onover, 'show_tooltip();');
  76. txtadd(hotspot[%1].onout, 'hide_tooltip();');
  77. );
  78. ,
  79. ifnot(layer[%1].tooltip_oy,
  80. set(layer[%1].tooltip_oy, 000);
  81. );
  82. ifnot(layer[%1].tooltip, set(layer[%1].tooltip, ''); );
  83. if(device.touchdevice,
  84. ifnot(layer[%1].ondown, set(layer[%1].ondown, ''));
  85. ifnot(layer[%1].onup, set(layer[%1].onup, ''));
  86. txtadd(layer[%1].ondown, 'show_tooltip();');
  87. txtadd(layer[%1].onup, 'hide_tooltip();');
  88. ,
  89. ifnot(layer[%1].onover, set(layer[%1].onover, ''));
  90. ifnot(layer[%1].onout, set(layer[%1].onout, ''));
  91. txtadd(layer[%1].onover, 'show_tooltip();');
  92. txtadd(layer[%1].onout, 'hide_tooltip();');
  93. );
  94. );
  95. </action>
  96. <action name="fadein_tooltip">set(layer[tooltip].visible, true); set(layer[tooltip_arrow].visible, true); tween(layer[tooltip].alpha, 1, .10); tween(layer[tooltip_arrow].alpha, 1, .10);</action>
  97. <action name="show_tooltip">
  98. if(tooltip,
  99. if(settings[tooltip].visible
  100. ,
  101. copy(layer[tooltip].html, tooltip);
  102. copy(layer[tooltip].current, name);
  103. if(tooltip_oy != '000',
  104. copy(layer[tooltip_arrow].oy, tooltip_oy);
  105. copy(layer[tooltip].oy, tooltip_oy);
  106. sub(layer[tooltip].oy, layer[tooltip_arrow].pixelheight);
  107. ,
  108. copy(layer[tooltip_arrow].oy, settings[tooltip].oy);
  109. copy(layer[tooltip].oy, settings[tooltip].oy);
  110. sub(layer[tooltip].oy, layer[tooltip_arrow].pixelheight);
  111. );
  112. set(arrow_offset, 5);
  113. <!--if(device.pixelratio GT 1, mul(arrow_offset, 2););-->
  114. add(layer[tooltip_arrow].oy, arrow_offset);
  115. add(layer[tooltip].oy, arrow_offset);
  116. if(tooltip_style,
  117. set_tooltip_style(get(tooltip_style));
  118. ,
  119. reset_tooltip_style();
  120. );
  121. delayedcall(.06,
  122. if(device.touchdevice,
  123. if(layer[get(layer[tooltip].current)].pressed,
  124. fadein_tooltip();
  125. ,
  126. if(hotspot[get(layer[tooltip].current)].pressed,
  127. fadein_tooltip();
  128. );
  129. );
  130. ,
  131. if(layer[get(layer[tooltip].current)].hovering,
  132. fadein_tooltip();
  133. ,
  134. if(hotspot[get(layer[tooltip].current)].hovering,
  135. fadein_tooltip();
  136. );
  137. );
  138. );
  139. );
  140. set(i, 0);
  141. update_tooltip_posiition();
  142. if(device.touchdevice,
  143. asyncloop(pressed, update_tooltip_posiition(); );
  144. ,
  145. if (ath !== null,
  146. asyncloop(hotspot[get(name)].hovering, update_tooltip_posiition(); , hide_tooltip(); );
  147. ,
  148. asyncloop(layer[get(name)].hovering, update_tooltip_posiition(); );
  149. );
  150. );
  151. ));</action>
  152. <action name="hide_tooltip">stoptween(layer[tooltip].alpha); stoptween(layer[tooltip_arrow].alpha); set(layer[tooltip].alpha, 0); set(layer[tooltip_arrow].alpha, 0); set(layer[tooltip].visible,false); set(layer[tooltip_arrow].visible,false);</action>
  153. <action name="update_tooltip_posiition">
  154. if (ath !== null,
  155. spheretoscreen(ath, atv, abs_x, abs_y);
  156. ,
  157. plugin[abs].get_y(abs_y, get(name));
  158. plugin[abs].get_x(abs_x, get(name), center);
  159. );
  160. copy(layer[tooltip].y, abs_y);
  161. copy(layer[tooltip_arrow].y, abs_y);
  162. copy(layer[tooltip].x, abs_x);
  163. copy(layer[tooltip_arrow].x, abs_x);
  164. div(half_tooltip, layer[tooltip].width, 2);
  165. sub(tooltip_left, layer[tooltip].x, half_tooltip);
  166. set(max_tooltip, 4);
  167. <!--if(device.pixelratio GT 1, mul(max_tooltip, 2)); -->
  168. if(tooltip_left LT max_tooltip,
  169. copy(layer[tooltip].x, tooltip_left);
  170. mul(layer[tooltip].x, -1);
  171. add(layer[tooltip].x, abs_x);
  172. add(layer[tooltip].x, max_tooltip);
  173. ,
  174. div(half_tooltip, layer[tooltip].width, 2);
  175. add(tooltip_right, layer[tooltip].x, half_tooltip);
  176. sub(tooltip_right, stagewidth, tooltip_right);
  177. if(tooltip_right LT max_tooltip,
  178. add(layer[tooltip].x, tooltip_right);
  179. sub(layer[tooltip].x, max_tooltip);
  180. );
  181. );
  182. set(max_arrow, 14);
  183. <!--if(device.pixelratio GT 1, mul(max_arrow, 2)); -->
  184. if(layer[tooltip_arrow].x LT max_arrow, copy(layer[tooltip_arrow].x, max_arrow); , sub(arrow_limit, stagewidth, max_arrow); if(layer[tooltip_arrow].x GT arrow_limit, copy(layer[tooltip_arrow].x, arrow_limit); ); );</action>
  185. <action name="mul_padding">indexoftxt(p_index, get(style[%1].padding), ' ', %2); add(p_next_start, 1, p_index); sub(p_length, p_index, %2); set(p_start, %2); if(p_index LT 0, set(p_length, 3); ); subtxt(padding_value, style[%1].padding, get(p_start), get(p_length)); mul(padding_value, 2); txtadd(style[%1].padding_2x, get(padding_value)); if(p_index GT 0, txtadd(style[%1].padding_2x, ' '); mul_padding(%1, get(p_next_start)); );</action>
  186. </krpano>