arrow-symbols.src.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /**
  2. * @license Highcharts JS v8.0.0 (2019-12-10)
  3. *
  4. * Arrow Symbols
  5. *
  6. * (c) 2017-2019 Lars A. V. Cabrera
  7. *
  8. * License: www.highcharts.com/license
  9. */
  10. 'use strict';
  11. (function (factory) {
  12. if (typeof module === 'object' && module.exports) {
  13. factory['default'] = factory;
  14. module.exports = factory;
  15. } else if (typeof define === 'function' && define.amd) {
  16. define('highcharts/modules/arrow-symbols', ['highcharts'], function (Highcharts) {
  17. factory(Highcharts);
  18. factory.Highcharts = Highcharts;
  19. return factory;
  20. });
  21. } else {
  22. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  23. }
  24. }(function (Highcharts) {
  25. var _modules = Highcharts ? Highcharts._modules : {};
  26. function _registerModule(obj, path, args, fn) {
  27. if (!obj.hasOwnProperty(path)) {
  28. obj[path] = fn.apply(null, args);
  29. }
  30. }
  31. _registerModule(_modules, 'parts-gantt/ArrowSymbols.js', [_modules['parts/Globals.js']], function (H) {
  32. /* *
  33. *
  34. * (c) 2017 Highsoft AS
  35. * Authors: Lars A. V. Cabrera
  36. *
  37. * License: www.highcharts.com/license
  38. *
  39. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  40. *
  41. * */
  42. /**
  43. * Creates an arrow symbol. Like a triangle, except not filled.
  44. * ```
  45. * o
  46. * o
  47. * o
  48. * o
  49. * o
  50. * o
  51. * o
  52. * ```
  53. *
  54. * @private
  55. * @function
  56. *
  57. * @param {number} x
  58. * x position of the arrow
  59. *
  60. * @param {number} y
  61. * y position of the arrow
  62. *
  63. * @param {number} w
  64. * width of the arrow
  65. *
  66. * @param {number} h
  67. * height of the arrow
  68. *
  69. * @return {Highcharts.SVGPathArray}
  70. * Path array
  71. */
  72. H.SVGRenderer.prototype.symbols.arrow = function (x, y, w, h) {
  73. return [
  74. 'M', x, y + h / 2,
  75. 'L', x + w, y,
  76. 'L', x, y + h / 2,
  77. 'L', x + w, y + h
  78. ];
  79. };
  80. /**
  81. * Creates a half-width arrow symbol. Like a triangle, except not filled.
  82. * ```
  83. * o
  84. * o
  85. * o
  86. * o
  87. * o
  88. * ```
  89. *
  90. * @private
  91. * @function
  92. *
  93. * @param {number} x
  94. * x position of the arrow
  95. *
  96. * @param {number} y
  97. * y position of the arrow
  98. *
  99. * @param {number} w
  100. * width of the arrow
  101. *
  102. * @param {number} h
  103. * height of the arrow
  104. *
  105. * @return {Highcharts.SVGPathArray}
  106. * Path array
  107. */
  108. H.SVGRenderer.prototype.symbols['arrow-half'] = function (x, y, w, h) {
  109. return H.SVGRenderer.prototype.symbols.arrow(x, y, w / 2, h);
  110. };
  111. /**
  112. * Creates a left-oriented triangle.
  113. * ```
  114. * o
  115. * ooooooo
  116. * ooooooooooooo
  117. * ooooooo
  118. * o
  119. * ```
  120. *
  121. * @private
  122. * @function
  123. *
  124. * @param {number} x
  125. * x position of the triangle
  126. *
  127. * @param {number} y
  128. * y position of the triangle
  129. *
  130. * @param {number} w
  131. * width of the triangle
  132. *
  133. * @param {number} h
  134. * height of the triangle
  135. *
  136. * @return {Highcharts.SVGPathArray}
  137. * Path array
  138. */
  139. H.SVGRenderer.prototype.symbols['triangle-left'] = function (x, y, w, h) {
  140. return [
  141. 'M', x + w, y,
  142. 'L', x, y + h / 2,
  143. 'L', x + w, y + h,
  144. 'Z'
  145. ];
  146. };
  147. /**
  148. * Alias function for triangle-left.
  149. *
  150. * @private
  151. * @function
  152. *
  153. * @param {number} x
  154. * x position of the arrow
  155. *
  156. * @param {number} y
  157. * y position of the arrow
  158. *
  159. * @param {number} w
  160. * width of the arrow
  161. *
  162. * @param {number} h
  163. * height of the arrow
  164. *
  165. * @return {Highcharts.SVGPathArray}
  166. * Path array
  167. */
  168. H.SVGRenderer.prototype.symbols['arrow-filled'] =
  169. H.SVGRenderer.prototype.symbols['triangle-left'];
  170. /**
  171. * Creates a half-width, left-oriented triangle.
  172. * ```
  173. * o
  174. * oooo
  175. * ooooooo
  176. * oooo
  177. * o
  178. * ```
  179. *
  180. * @private
  181. * @function
  182. *
  183. * @param {number} x
  184. * x position of the triangle
  185. *
  186. * @param {number} y
  187. * y position of the triangle
  188. *
  189. * @param {number} w
  190. * width of the triangle
  191. *
  192. * @param {number} h
  193. * height of the triangle
  194. *
  195. * @return {Highcharts.SVGPathArray}
  196. * Path array
  197. */
  198. H.SVGRenderer.prototype.symbols['triangle-left-half'] = function (x, y, w, h) {
  199. return H.SVGRenderer.prototype.symbols['triangle-left'](x, y, w / 2, h);
  200. };
  201. /**
  202. * Alias function for triangle-left-half.
  203. *
  204. * @private
  205. * @function
  206. *
  207. * @param {number} x
  208. * x position of the arrow
  209. *
  210. * @param {number} y
  211. * y position of the arrow
  212. *
  213. * @param {number} w
  214. * width of the arrow
  215. *
  216. * @param {number} h
  217. * height of the arrow
  218. *
  219. * @return {Highcharts.SVGPathArray}
  220. * Path array
  221. */
  222. H.SVGRenderer.prototype.symbols['arrow-filled-half'] =
  223. H.SVGRenderer.prototype.symbols['triangle-left-half'];
  224. });
  225. _registerModule(_modules, 'masters/modules/arrow-symbols.src.js', [], function () {
  226. });
  227. }));