MapNavigationOptionsDefault.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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 D from '../Core/DefaultOptions.js';
  12. import U from '../Core/Utilities.js';
  13. var extend = U.extend;
  14. /* *
  15. *
  16. * Constants
  17. *
  18. * */
  19. /**
  20. * @product highmaps
  21. * @optionparent mapNavigation
  22. */
  23. var defaultOptions = {
  24. /**
  25. * General options for the map navigation buttons. Individual options
  26. * can be given from the [mapNavigation.buttons](#mapNavigation.buttons)
  27. * option set.
  28. *
  29. * @sample {highmaps} maps/mapnavigation/button-theme/
  30. * Theming the navigation buttons
  31. */
  32. buttonOptions: {
  33. /**
  34. * What box to align the buttons to. Possible values are `plotBox`
  35. * and `spacingBox`.
  36. *
  37. * @type {Highcharts.ButtonRelativeToValue}
  38. */
  39. alignTo: 'plotBox',
  40. /**
  41. * The alignment of the navigation buttons.
  42. *
  43. * @type {Highcharts.AlignValue}
  44. */
  45. align: 'left',
  46. /**
  47. * The vertical alignment of the buttons. Individual alignment can
  48. * be adjusted by each button's `y` offset.
  49. *
  50. * @type {Highcharts.VerticalAlignValue}
  51. */
  52. verticalAlign: 'top',
  53. /**
  54. * The X offset of the buttons relative to its `align` setting.
  55. */
  56. x: 0,
  57. /**
  58. * The width of the map navigation buttons.
  59. */
  60. width: 18,
  61. /**
  62. * The pixel height of the map navigation buttons.
  63. */
  64. height: 18,
  65. /**
  66. * Padding for the navigation buttons.
  67. *
  68. * @since 5.0.0
  69. */
  70. padding: 5,
  71. /**
  72. * Text styles for the map navigation buttons.
  73. *
  74. * @type {Highcharts.CSSObject}
  75. * @default {"fontSize": "15px", "fontWeight": "bold"}
  76. */
  77. style: {
  78. /** @ignore */
  79. fontSize: '15px',
  80. /** @ignore */
  81. fontWeight: 'bold'
  82. },
  83. /**
  84. * A configuration object for the button theme. The object accepts
  85. * SVG properties like `stroke-width`, `stroke` and `fill`. Tri-state
  86. * button styles are supported by the `states.hover` and `states.select`
  87. * objects.
  88. *
  89. * @sample {highmaps} maps/mapnavigation/button-theme/
  90. * Themed navigation buttons
  91. *
  92. * @type {Highcharts.SVGAttributes}
  93. * @default {"stroke-width": 1, "text-align": "center"}
  94. */
  95. theme: {
  96. /** @ignore */
  97. 'stroke-width': 1,
  98. /** @ignore */
  99. 'text-align': 'center'
  100. }
  101. },
  102. /**
  103. * The individual buttons for the map navigation. This usually includes
  104. * the zoom in and zoom out buttons. Properties for each button is
  105. * inherited from
  106. * [mapNavigation.buttonOptions](#mapNavigation.buttonOptions), while
  107. * individual options can be overridden. But default, the `onclick`, `text`
  108. * and `y` options are individual.
  109. */
  110. buttons: {
  111. /**
  112. * Options for the zoom in button. Properties for the zoom in and zoom
  113. * out buttons are inherited from
  114. * [mapNavigation.buttonOptions](#mapNavigation.buttonOptions), while
  115. * individual options can be overridden. By default, the `onclick`,
  116. * `text` and `y` options are individual.
  117. *
  118. * @extends mapNavigation.buttonOptions
  119. */
  120. zoomIn: {
  121. // eslint-disable-next-line valid-jsdoc
  122. /**
  123. * Click handler for the button.
  124. *
  125. * @type {Function}
  126. * @default function () { this.mapZoom(0.5); }
  127. */
  128. onclick: function () {
  129. this.mapZoom(0.5);
  130. },
  131. /**
  132. * The text for the button. The tooltip (title) is a language option
  133. * given by [lang.zoomIn](#lang.zoomIn).
  134. */
  135. text: '+',
  136. /**
  137. * The position of the zoomIn button relative to the vertical
  138. * alignment.
  139. */
  140. y: 0
  141. },
  142. /**
  143. * Options for the zoom out button. Properties for the zoom in and
  144. * zoom out buttons are inherited from
  145. * [mapNavigation.buttonOptions](#mapNavigation.buttonOptions), while
  146. * individual options can be overridden. By default, the `onclick`,
  147. * `text` and `y` options are individual.
  148. *
  149. * @extends mapNavigation.buttonOptions
  150. */
  151. zoomOut: {
  152. // eslint-disable-next-line valid-jsdoc
  153. /**
  154. * Click handler for the button.
  155. *
  156. * @type {Function}
  157. * @default function () { this.mapZoom(2); }
  158. */
  159. onclick: function () {
  160. this.mapZoom(2);
  161. },
  162. /**
  163. * The text for the button. The tooltip (title) is a language option
  164. * given by [lang.zoomOut](#lang.zoomIn).
  165. */
  166. text: '-',
  167. /**
  168. * The position of the zoomOut button relative to the vertical
  169. * alignment.
  170. */
  171. y: 28
  172. }
  173. },
  174. /**
  175. * Whether to enable navigation buttons. By default it inherits the
  176. * [enabled](#mapNavigation.enabled) setting.
  177. *
  178. * @type {boolean}
  179. * @apioption mapNavigation.enableButtons
  180. */
  181. /**
  182. * Whether to enable map navigation. The default is not to enable
  183. * navigation, as many choropleth maps are simple and don't need it.
  184. * Additionally, when touch zoom and mousewheel zoom is enabled, it breaks
  185. * the default behaviour of these interactions in the website, and the
  186. * implementer should be aware of this.
  187. *
  188. * Individual interactions can be enabled separately, namely buttons,
  189. * multitouch zoom, double click zoom, double click zoom to element and
  190. * mousewheel zoom.
  191. *
  192. * @type {boolean}
  193. * @default false
  194. * @apioption mapNavigation.enabled
  195. */
  196. /**
  197. * Enables zooming in on an area on double clicking in the map. By default
  198. * it inherits the [enabled](#mapNavigation.enabled) setting.
  199. *
  200. * @type {boolean}
  201. * @apioption mapNavigation.enableDoubleClickZoom
  202. */
  203. /**
  204. * Whether to zoom in on an area when that area is double clicked.
  205. *
  206. * @sample {highmaps} maps/mapnavigation/doubleclickzoomto/
  207. * Enable double click zoom to
  208. *
  209. * @type {boolean}
  210. * @default false
  211. * @apioption mapNavigation.enableDoubleClickZoomTo
  212. */
  213. /**
  214. * Enables zooming by mouse wheel. By default it inherits the [enabled](
  215. * #mapNavigation.enabled) setting.
  216. *
  217. * @type {boolean}
  218. * @apioption mapNavigation.enableMouseWheelZoom
  219. */
  220. /**
  221. * Whether to enable multitouch zooming. Note that if the chart covers the
  222. * viewport, this prevents the user from using multitouch and touchdrag on
  223. * the web page, so you should make sure the user is not trapped inside the
  224. * chart. By default it inherits the [enabled](#mapNavigation.enabled)
  225. * setting.
  226. *
  227. * @type {boolean}
  228. * @apioption mapNavigation.enableTouchZoom
  229. */
  230. /**
  231. * Sensitivity of mouse wheel or trackpad scrolling. 1 is no sensitivity,
  232. * while with 2, one mousewheel delta will zoom in 50%.
  233. *
  234. * @since 4.2.4
  235. */
  236. mouseWheelSensitivity: 1.1
  237. // enabled: false,
  238. // enableButtons: null, // inherit from enabled
  239. // enableTouchZoom: null, // inherit from enabled
  240. // enableDoubleClickZoom: null, // inherit from enabled
  241. // enableDoubleClickZoomTo: false
  242. // enableMouseWheelZoom: null, // inherit from enabled
  243. };
  244. /* *
  245. *
  246. * Composition
  247. *
  248. * */
  249. // Add language
  250. extend(D.defaultOptions.lang, {
  251. zoomIn: 'Zoom in',
  252. zoomOut: 'Zoom out'
  253. });
  254. // Set the default map navigation options
  255. D.defaultOptions.mapNavigation = defaultOptions;
  256. /* *
  257. *
  258. * Default Export
  259. *
  260. * */
  261. export default defaultOptions;