MapSymbols.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* *
  2. *
  3. * (c) 2010-2021 Torstein Honsi
  4. *
  5. * License: www.highcharts.com/license
  6. *
  7. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  8. *
  9. * */
  10. 'use strict';
  11. import SVGRenderer from '../Core/Renderer/SVG/SVGRenderer.js';
  12. var symbols = SVGRenderer.prototype.symbols;
  13. /* *
  14. *
  15. * Functions
  16. *
  17. * */
  18. /* eslint-disable require-jsdoc, valid-jsdoc */
  19. function bottomButton(x, y, w, h, options) {
  20. var r = (options && options.r) || 0;
  21. return selectiveRoundedRect(x - 1, y - 1, w, h, 0, 0, r, r);
  22. }
  23. /**
  24. * Create symbols for the zoom buttons
  25. * @private
  26. */
  27. function selectiveRoundedRect(x, y, w, h, rTopLeft, rTopRight, rBottomRight, rBottomLeft) {
  28. return [
  29. ['M', x + rTopLeft, y],
  30. // top side
  31. ['L', x + w - rTopRight, y],
  32. // top right corner
  33. ['C', x + w - rTopRight / 2, y, x + w, y + rTopRight / 2, x + w, y + rTopRight],
  34. // right side
  35. ['L', x + w, y + h - rBottomRight],
  36. // bottom right corner
  37. ['C', x + w, y + h - rBottomRight / 2, x + w - rBottomRight / 2, y + h, x + w - rBottomRight, y + h],
  38. // bottom side
  39. ['L', x + rBottomLeft, y + h],
  40. // bottom left corner
  41. ['C', x + rBottomLeft / 2, y + h, x, y + h - rBottomLeft / 2, x, y + h - rBottomLeft],
  42. // left side
  43. ['L', x, y + rTopLeft],
  44. // top left corner
  45. ['C', x, y + rTopLeft / 2, x + rTopLeft / 2, y, x + rTopLeft, y],
  46. ['Z']
  47. ];
  48. }
  49. function topButton(x, y, w, h, options) {
  50. var r = (options && options.r) || 0;
  51. return selectiveRoundedRect(x - 1, y - 1, w, h, r, r, 0, 0);
  52. }
  53. symbols.bottombutton = bottomButton;
  54. symbols.topbutton = topButton;
  55. /* *
  56. *
  57. * Default Export
  58. *
  59. * */
  60. export default symbols;