react-spatial 1.5.7 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +1 -5
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +1 -1
  3. package/components/BaseLayerSwitcher/BaseLayerSwitcher.scss +3 -3
  4. package/components/BaseLayerSwitcher/index.js.map +1 -1
  5. package/components/BasicMap/BasicMap.js +1 -16
  6. package/components/BasicMap/BasicMap.js.map +2 -2
  7. package/components/BasicMap/index.js.map +1 -1
  8. package/components/CanvasSaveButton/CanvasSaveButton.js.map +1 -1
  9. package/components/CanvasSaveButton/index.js.map +1 -1
  10. package/components/Copyright/Copyright.js.map +1 -1
  11. package/components/Copyright/index.js.map +1 -1
  12. package/components/FeatureExportButton/FeatureExportButton.js.map +1 -1
  13. package/components/FeatureExportButton/index.js.map +1 -1
  14. package/components/FitExtent/FitExtent.js.map +1 -1
  15. package/components/FitExtent/index.js.map +1 -1
  16. package/components/Geolocation/Geolocation.js.map +1 -1
  17. package/components/Geolocation/index.js.map +1 -1
  18. package/components/LayerTree/LayerTree.js.map +1 -1
  19. package/components/LayerTree/LayerTree.scss +0 -4
  20. package/components/LayerTree/index.js.map +1 -1
  21. package/components/MousePosition/MousePosition.js.map +1 -1
  22. package/components/MousePosition/index.js.map +1 -1
  23. package/components/NorthArrow/NorthArrow.js.map +1 -1
  24. package/components/NorthArrow/index.js.map +1 -1
  25. package/components/Overlay/Overlay.js +3 -3
  26. package/components/Overlay/Overlay.js.map +2 -2
  27. package/components/Overlay/index.js.map +1 -1
  28. package/components/Permalink/Permalink.js +13 -9
  29. package/components/Permalink/Permalink.js.map +2 -2
  30. package/components/Permalink/index.js.map +1 -1
  31. package/components/Popup/Popup.js.map +1 -1
  32. package/components/Popup/Popup.md.scss +1 -0
  33. package/components/Popup/index.js.map +1 -1
  34. package/components/ResizeHandler/ResizeHandler.js.map +1 -1
  35. package/components/ResizeHandler/index.js.map +1 -1
  36. package/components/RouteSchedule/RouteSchedule.js +16 -7
  37. package/components/RouteSchedule/RouteSchedule.js.map +2 -2
  38. package/components/RouteSchedule/RouteSchedule.scss +8 -8
  39. package/components/RouteSchedule/index.js.map +1 -1
  40. package/components/ScaleLine/ScaleLine.js.map +1 -1
  41. package/components/ScaleLine/ScaleLine.scss +1 -1
  42. package/components/ScaleLine/index.js.map +1 -1
  43. package/components/StopsFinder/StopsFinder.js.map +1 -1
  44. package/components/StopsFinder/StopsFinderOption.js +1 -1
  45. package/components/StopsFinder/StopsFinderOption.js.map +2 -2
  46. package/components/StopsFinder/index.js.map +1 -1
  47. package/components/Zoom/Zoom.js.map +1 -1
  48. package/components/Zoom/Zoom.scss +1 -1
  49. package/components/Zoom/index.js.map +1 -1
  50. package/package.json +34 -44
  51. package/propTypes.js.map +1 -1
  52. package/setupTests.js +2 -0
  53. package/setupTests.js.map +2 -2
  54. package/themes/default/components.scss +9 -9
  55. package/themes/default/examples.scss +15 -15
  56. package/themes/default/index.scss +3 -3
  57. package/themes/default/variables.scss +18 -16
  58. package/utils/GlobalsForOle.js.map +1 -1
  59. package/utils/KML.js +1 -1
  60. package/utils/KML.js.map +2 -2
  61. package/utils/Styles.js.map +1 -1
  62. package/utils/getPolygonPattern.js.map +1 -1
  63. package/utils/timeUtils.js.map +1 -1
  64. package/utils/KMLFormat.js +0 -97
  65. package/utils/KMLFormat.js.map +0 -7
package/README.md CHANGED
@@ -17,7 +17,7 @@ Documentation and examples at https://react-spatial.geops.io.
17
17
  Install the [react-spatial](https://www.npmjs.com/package/react-spatial) package:
18
18
 
19
19
  ```bash
20
- yarn add mobility-toolbox-js mapbox-gl ol react-spatial
20
+ yarn add mobility-toolbox-js mapbox-gl mapblibre-gl ol react-spatial
21
21
  ```
22
22
 
23
23
  Your build pipeline needs to support ES6 modules and SASS.
@@ -37,7 +37,3 @@ import 'react-spatial/themes/default/index.scss';
37
37
  ## Bugs
38
38
 
39
39
  Please use the [GitHub issue tracker](https://github.com/geops/react-spatial/issues) for all bugs and feature requests. Before creating a new issue, do a quick search to see if the problem has been reported already.
40
-
41
- ## Version 1.x.x
42
-
43
- The master branch is now open for the version 2 development. The version 1 is now available in 1.x.x branch.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/BaseLayerSwitcher/BaseLayerSwitcher.js"],
4
- "sourcesContent": ["/* eslint-disable jsx-a11y/interactive-supports-focus */\nimport React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { FaChevronLeft } from 'react-icons/fa';\nimport { Layer } from 'mobility-toolbox-js/ol';\nimport { unByKey } from 'ol/Observable';\n\nconst propTypes = {\n /**\n * An array of [mobility-toolbox-js layers](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers).\n */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)).isRequired,\n\n /**\n * Object containing relative paths to the base layer images. Object\n * keys need to correspond to layer keys\n */\n layerImages: PropTypes.objectOf(PropTypes.string),\n\n /**\n * CSS class to apply on the container.\n */\n className: PropTypes.string,\n\n /**\n * Alternative text rendered if layer images can't be loaded\n */\n altText: PropTypes.string,\n\n /**\n * Button titles.\n */\n titles: PropTypes.shape({\n button: PropTypes.string,\n openSwitcher: PropTypes.string,\n closeSwitcher: PropTypes.string,\n }),\n\n /**\n * Image (node) rendered in the switcher close button.\n */\n closeButtonImage: PropTypes.node,\n\n /**\n * Translation function.\n * @param {function} Translation function returning the translated string.\n */\n t: PropTypes.func,\n};\n\nconst defaultProps = {\n className: 'rs-base-layer-switcher',\n altText: 'Source not found',\n titles: {\n button: 'Base layers',\n openSwitcher: 'Open Baselayer-Switcher',\n closeSwitcher: 'Close Baselayer-Switcher',\n },\n closeButtonImage: <FaChevronLeft />,\n layerImages: undefined,\n t: (s) => {\n return s;\n },\n};\n\nconst getVisibleLayer = (layers) => {\n return layers.find((layer) => {\n return layer.visible;\n });\n};\n\nconst getNextImage = (currentLayer, layers, layerImages) => {\n const currentIndex = layers.indexOf(\n layers.find((layer) => {\n return layer === currentLayer;\n }),\n );\n const nextIndex = currentIndex + 1 === layers.length ? 0 : currentIndex + 1;\n return layerImages[nextIndex];\n};\n\nconst getImageStyle = (url) => {\n return url\n ? {\n backgroundImage: `url(${url})`,\n backgroundSize: 'cover',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n }\n : null;\n};\n\n/**\n * The BaseLayerSwitcher component renders a button interface for switching the visible\n * [mobility-toolbox-js layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers)\n * when defined as base layer.\n */\n\nfunction BaseLayerSwitcher({\n layers,\n layerImages,\n className,\n altText,\n titles,\n closeButtonImage,\n t,\n}) {\n const [switcherOpen, setSwitcherOpen] = useState(false);\n const [isClosed, setIsClosed] = useState(true);\n const [currentLayer, setCurrentLayer] = useState(\n getVisibleLayer(layers) || layers[0],\n );\n\n useEffect(() => {\n // Update the layer selected when a visibility changes.\n const olKeys = (layers || []).map((layer) => {\n return layer.on('change:visible', (evt) => {\n if (evt.target.visible && currentLayer !== evt.target) {\n setCurrentLayer(evt.target);\n }\n });\n });\n return () => {\n unByKey(olKeys);\n };\n }, [currentLayer, layers]);\n\n /* Images are loaded from props if provided, fallback from layer */\n const images = layerImages\n ? Object.keys(layerImages).map((layerImage) => {\n return layerImages[layerImage];\n })\n : layers.map((layer) => {\n return layer.get('previewImage');\n });\n\n const openClass = switcherOpen ? ' rs-open' : '';\n const hiddenStyle = switcherOpen && !isClosed ? 'visible' : 'hidden';\n\n const handleSwitcherClick = () => {\n if (layers.length === 2) {\n /* On only two layer options the opener becomes a layer toggle button */\n const nextLayer = layers.find((layer) => {\n return !layer.visible;\n });\n if (currentLayer.setVisible) {\n currentLayer.setVisible(false);\n } else {\n currentLayer.visible = false;\n }\n setCurrentLayer(nextLayer);\n if (nextLayer.setVisible) {\n nextLayer.setVisible(true);\n } else {\n nextLayer.visible = true;\n }\n return;\n }\n // eslint-disable-next-line consistent-return\n return setSwitcherOpen(true) && setIsClosed(false);\n };\n\n const onLayerSelect = (layer) => {\n if (!switcherOpen) {\n setSwitcherOpen(true);\n return;\n }\n setCurrentLayer(layer);\n if (layer.setVisible) {\n layer.setVisible(true);\n } else {\n // eslint-disable-next-line no-param-reassign\n layer.visible = true;\n }\n layers\n .filter((l) => {\n return l !== layer;\n })\n .forEach((l) => {\n if (l.setVisible) {\n l.setVisible(false);\n } else {\n // eslint-disable-next-line no-param-reassign\n l.visible = false;\n }\n });\n setSwitcherOpen(false);\n };\n\n /* Get next image for closed button */\n const nextImage = getNextImage(currentLayer, layers, images);\n\n useEffect(() => {\n /* Ensure correct layer is active on app load */\n if (currentLayer !== getVisibleLayer(layers)) {\n setCurrentLayer(getVisibleLayer(layers) || layers[0]);\n }\n }, [currentLayer, layers]);\n\n useEffect(() => {\n /* Used for correct layer image render with animation */\n let timeout;\n if (!switcherOpen) {\n timeout = setTimeout(() => {\n setIsClosed(true);\n }, 200);\n } else {\n timeout = setTimeout(() => {\n setIsClosed(false);\n }, 800);\n }\n return () => {\n return clearTimeout(timeout);\n };\n }, [switcherOpen]);\n\n if (!layers || layers.length < 2 || !currentLayer) {\n return null;\n }\n\n const toggleBtn = (\n <div className=\"rs-base-layer-switcher-btn-wrapper\">\n <div\n className=\"rs-base-layer-switcher-close-btn\"\n role=\"button\"\n onClick={() => {\n return setSwitcherOpen(false);\n }}\n onKeyPress={(e) => {\n return e.which === 13 && setSwitcherOpen(false);\n }}\n tabIndex={switcherOpen ? '0' : '-1'}\n aria-label={titles.closeSwitcher}\n title={titles.closeSwitcher}\n >\n {closeButtonImage}\n </div>\n </div>\n );\n\n return (\n <div className={`${className}${openClass}`}>\n <div\n className={`rs-base-layer-switcher-button rs-opener${openClass}`}\n role=\"button\"\n title={titles.openSwitcher}\n aria-label={titles.openSwitcher}\n onClick={handleSwitcherClick}\n onKeyPress={(e) => {\n if (e.which === 13) {\n handleSwitcherClick();\n }\n }}\n style={getImageStyle(nextImage)}\n tabIndex=\"0\"\n >\n <div className=\"rs-base-layer-switcher-title\">\n {layers.length !== 2\n ? titles.button\n : layers.find((layer) => {\n return !layer.visible;\n }) &&\n t(\n layers.find((layer) => {\n return !layer.visible;\n }).name,\n )}\n </div>\n {nextImage ? null : <span className=\"rs-alt-text\">{t(altText)}</span>}\n </div>\n {layers.map((layer, idx) => {\n const layerName = layer.name;\n const activeClass = layerName === currentLayer.name ? ' rs-active' : '';\n const imageStyle = getImageStyle(\n layerImages ? layerImages[`${layer.key}`] : layer.get('previewImage'),\n );\n return (\n <div\n key={layer.key}\n className=\"rs-base-layer-switcher-btn-wrapper\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n overflow: hiddenStyle,\n /* stylelint-disable-next-line value-keyword-case */\n zIndex: layers.length - idx,\n }}\n >\n <div\n className={`rs-base-layer-switcher-button${openClass}`}\n role=\"button\"\n title={t(layerName)}\n aria-label={t(layerName)}\n onClick={() => {\n return onLayerSelect(layer);\n }}\n onKeyPress={(e) => {\n if (e.which === 13) {\n onLayerSelect(layer);\n }\n }}\n style={imageStyle}\n tabIndex={switcherOpen ? '0' : '-1'}\n >\n <div className={`rs-base-layer-switcher-title${activeClass}`}>\n {t(layerName)}\n </div>\n {imageStyle ? null : (\n <span className=\"rs-alt-text\">{t(altText)}</span>\n )}\n </div>\n </div>\n );\n })}\n {toggleBtn}\n </div>\n );\n}\n\nBaseLayerSwitcher.propTypes = propTypes;\nBaseLayerSwitcher.defaultProps = defaultProps;\n\nexport default BaseLayerSwitcher;\n"],
4
+ "sourcesContent": ["/* eslint-disable jsx-a11y/interactive-supports-focus */\nimport React, { useState, useEffect } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { FaChevronLeft } from \"react-icons/fa\";\nimport { Layer } from \"mobility-toolbox-js/ol\";\nimport { unByKey } from \"ol/Observable\";\n\nconst propTypes = {\n /**\n * An array of [mobility-toolbox-js layers](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers).\n */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)).isRequired,\n\n /**\n * Object containing relative paths to the base layer images. Object\n * keys need to correspond to layer keys\n */\n layerImages: PropTypes.objectOf(PropTypes.string),\n\n /**\n * CSS class to apply on the container.\n */\n className: PropTypes.string,\n\n /**\n * Alternative text rendered if layer images can't be loaded\n */\n altText: PropTypes.string,\n\n /**\n * Button titles.\n */\n titles: PropTypes.shape({\n button: PropTypes.string,\n openSwitcher: PropTypes.string,\n closeSwitcher: PropTypes.string,\n }),\n\n /**\n * Image (node) rendered in the switcher close button.\n */\n closeButtonImage: PropTypes.node,\n\n /**\n * Translation function.\n * @param {function} Translation function returning the translated string.\n */\n t: PropTypes.func,\n};\n\nconst defaultProps = {\n className: \"rs-base-layer-switcher\",\n altText: \"Source not found\",\n titles: {\n button: \"Base layers\",\n openSwitcher: \"Open Baselayer-Switcher\",\n closeSwitcher: \"Close Baselayer-Switcher\",\n },\n closeButtonImage: <FaChevronLeft />,\n layerImages: undefined,\n t: (s) => {\n return s;\n },\n};\n\nconst getVisibleLayer = (layers) => {\n return layers.find((layer) => {\n return layer.visible;\n });\n};\n\nconst getNextImage = (currentLayer, layers, layerImages) => {\n const currentIndex = layers.indexOf(\n layers.find((layer) => {\n return layer === currentLayer;\n }),\n );\n const nextIndex = currentIndex + 1 === layers.length ? 0 : currentIndex + 1;\n return layerImages[nextIndex];\n};\n\nconst getImageStyle = (url) => {\n return url\n ? {\n backgroundImage: `url(${url})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center\",\n }\n : null;\n};\n\n/**\n * The BaseLayerSwitcher component renders a button interface for switching the visible\n * [mobility-toolbox-js layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers)\n * when defined as base layer.\n */\n\nfunction BaseLayerSwitcher({\n layers,\n layerImages,\n className,\n altText,\n titles,\n closeButtonImage,\n t,\n}) {\n const [switcherOpen, setSwitcherOpen] = useState(false);\n const [isClosed, setIsClosed] = useState(true);\n const [currentLayer, setCurrentLayer] = useState(\n getVisibleLayer(layers) || layers[0],\n );\n\n useEffect(() => {\n // Update the layer selected when a visibility changes.\n const olKeys = (layers || []).map((layer) => {\n return layer.on(\"change:visible\", (evt) => {\n if (evt.target.visible && currentLayer !== evt.target) {\n setCurrentLayer(evt.target);\n }\n });\n });\n return () => {\n unByKey(olKeys);\n };\n }, [currentLayer, layers]);\n\n /* Images are loaded from props if provided, fallback from layer */\n const images = layerImages\n ? Object.keys(layerImages).map((layerImage) => {\n return layerImages[layerImage];\n })\n : layers.map((layer) => {\n return layer.get(\"previewImage\");\n });\n\n const openClass = switcherOpen ? \" rs-open\" : \"\";\n const hiddenStyle = switcherOpen && !isClosed ? \"visible\" : \"hidden\";\n\n const handleSwitcherClick = () => {\n if (layers.length === 2) {\n /* On only two layer options the opener becomes a layer toggle button */\n const nextLayer = layers.find((layer) => {\n return !layer.visible;\n });\n if (currentLayer.setVisible) {\n currentLayer.setVisible(false);\n } else {\n currentLayer.visible = false;\n }\n setCurrentLayer(nextLayer);\n if (nextLayer.setVisible) {\n nextLayer.setVisible(true);\n } else {\n nextLayer.visible = true;\n }\n return;\n }\n // eslint-disable-next-line consistent-return\n return setSwitcherOpen(true) && setIsClosed(false);\n };\n\n const onLayerSelect = (layer) => {\n if (!switcherOpen) {\n setSwitcherOpen(true);\n return;\n }\n setCurrentLayer(layer);\n if (layer.setVisible) {\n layer.setVisible(true);\n } else {\n // eslint-disable-next-line no-param-reassign\n layer.visible = true;\n }\n layers\n .filter((l) => {\n return l !== layer;\n })\n .forEach((l) => {\n if (l.setVisible) {\n l.setVisible(false);\n } else {\n // eslint-disable-next-line no-param-reassign\n l.visible = false;\n }\n });\n setSwitcherOpen(false);\n };\n\n /* Get next image for closed button */\n const nextImage = getNextImage(currentLayer, layers, images);\n\n useEffect(() => {\n /* Ensure correct layer is active on app load */\n if (currentLayer !== getVisibleLayer(layers)) {\n setCurrentLayer(getVisibleLayer(layers) || layers[0]);\n }\n }, [currentLayer, layers]);\n\n useEffect(() => {\n /* Used for correct layer image render with animation */\n let timeout;\n if (!switcherOpen) {\n timeout = setTimeout(() => {\n setIsClosed(true);\n }, 200);\n } else {\n timeout = setTimeout(() => {\n setIsClosed(false);\n }, 800);\n }\n return () => {\n return clearTimeout(timeout);\n };\n }, [switcherOpen]);\n\n if (!layers || layers.length < 2 || !currentLayer) {\n return null;\n }\n\n const toggleBtn = (\n <div className=\"rs-base-layer-switcher-btn-wrapper\">\n <div\n className=\"rs-base-layer-switcher-close-btn\"\n role=\"button\"\n onClick={() => {\n return setSwitcherOpen(false);\n }}\n onKeyPress={(e) => {\n return e.which === 13 && setSwitcherOpen(false);\n }}\n tabIndex={switcherOpen ? \"0\" : \"-1\"}\n aria-label={titles.closeSwitcher}\n title={titles.closeSwitcher}\n >\n {closeButtonImage}\n </div>\n </div>\n );\n\n return (\n <div className={`${className}${openClass}`}>\n <div\n className={`rs-base-layer-switcher-button rs-opener${openClass}`}\n role=\"button\"\n title={titles.openSwitcher}\n aria-label={titles.openSwitcher}\n onClick={handleSwitcherClick}\n onKeyPress={(e) => {\n if (e.which === 13) {\n handleSwitcherClick();\n }\n }}\n style={getImageStyle(nextImage)}\n tabIndex=\"0\"\n >\n <div className=\"rs-base-layer-switcher-title\">\n {layers.length !== 2\n ? titles.button\n : layers.find((layer) => {\n return !layer.visible;\n }) &&\n t(\n layers.find((layer) => {\n return !layer.visible;\n }).name,\n )}\n </div>\n {nextImage ? null : <span className=\"rs-alt-text\">{t(altText)}</span>}\n </div>\n {layers.map((layer, idx) => {\n const layerName = layer.name;\n const activeClass = layerName === currentLayer.name ? \" rs-active\" : \"\";\n const imageStyle = getImageStyle(\n layerImages ? layerImages[`${layer.key}`] : layer.get(\"previewImage\"),\n );\n return (\n <div\n key={layer.key}\n className=\"rs-base-layer-switcher-btn-wrapper\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n overflow: hiddenStyle,\n /* stylelint-disable-next-line value-keyword-case */\n zIndex: layers.length - idx,\n }}\n >\n <div\n className={`rs-base-layer-switcher-button${openClass}`}\n role=\"button\"\n title={t(layerName)}\n aria-label={t(layerName)}\n onClick={() => {\n return onLayerSelect(layer);\n }}\n onKeyPress={(e) => {\n if (e.which === 13) {\n onLayerSelect(layer);\n }\n }}\n style={imageStyle}\n tabIndex={switcherOpen ? \"0\" : \"-1\"}\n >\n <div className={`rs-base-layer-switcher-title${activeClass}`}>\n {t(layerName)}\n </div>\n {imageStyle ? null : (\n <span className=\"rs-alt-text\">{t(altText)}</span>\n )}\n </div>\n </div>\n );\n })}\n {toggleBtn}\n </div>\n );\n}\n\nBaseLayerSwitcher.propTypes = propTypes;\nBaseLayerSwitcher.defaultProps = defaultProps;\n\nexport default BaseLayerSwitcher;\n"],
5
5
  "mappings": "AACA,OAAO,SAAS,UAAU,iBAAiB;AAC3C,OAAO,eAAe;AACtB,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,eAAe;AAExB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,QAAQ,UAAU,QAAQ,UAAU,WAAW,KAAK,CAAC,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvD,aAAa,UAAU,SAAS,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA,EAKhD,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA,EAKrB,SAAS,UAAU;AAAA;AAAA;AAAA;AAAA,EAKnB,QAAQ,UAAU,MAAM;AAAA,IACtB,QAAQ,UAAU;AAAA,IAClB,cAAc,UAAU;AAAA,IACxB,eAAe,UAAU;AAAA,EAC3B,CAAC;AAAA;AAAA;AAAA;AAAA,EAKD,kBAAkB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,GAAG,UAAU;AACf;AAEA,MAAM,eAAe;AAAA,EACnB,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ;AAAA,IACN,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,eAAe;AAAA,EACjB;AAAA,EACA,k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B,kBAAkB,eAAe;AAEjC,eAAe;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,7 @@
4
4
  transition: 800ms width;
5
5
  overflow: hidden;
6
6
  display: flex;
7
- padding: 2px 2px;
7
+ padding: 2px;
8
8
  pointer-events: none;
9
9
 
10
10
  &.rs-open {
@@ -20,7 +20,7 @@
20
20
  width: 100px;
21
21
  min-width: 100px;
22
22
  margin-right: 4px;
23
- background-color: rgb(197, 197, 197);
23
+ background-color: rgb(197 197 197);
24
24
  border: 2px solid white;
25
25
  box-sizing: border-box;
26
26
  pointer-events: auto;
@@ -81,7 +81,7 @@
81
81
  font-size: 10px;
82
82
  padding: 2px 0;
83
83
  color: white;
84
- background-color: rgba(0, 0, 0, 0.7);
84
+ background-color: rgb(0 0 0 / 70%);
85
85
  text-align: center;
86
86
 
87
87
  &.rs-active {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/BaseLayerSwitcher/index.js"],
4
- "sourcesContent": ["export { default } from './BaseLayerSwitcher';\n"],
4
+ "sourcesContent": ["export { default } from \"./BaseLayerSwitcher\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,6 @@ import View from "ol/View";
8
8
  import { unByKey } from "ol/Observable";
9
9
  import Interaction from "ol/interaction/Interaction";
10
10
  import { Layer } from "mobility-toolbox-js/ol";
11
- import ResizeHandler from "../ResizeHandler";
12
11
  const propTypes = {
13
12
  /** Map animation options */
14
13
  animationOptions: PropTypes.shape({
@@ -122,7 +121,6 @@ class BasicMap extends PureComponent {
122
121
  this.state = {
123
122
  node: null
124
123
  };
125
- this.layers = [];
126
124
  this.moveEndRef = null;
127
125
  this.singleClickRef = null;
128
126
  this.pointerMoveRef = null;
@@ -224,7 +222,6 @@ class BasicMap extends PureComponent {
224
222
  for (let i = 0; i < layers.length; i += 1) {
225
223
  this.initLayer(layers[i]);
226
224
  }
227
- this.layers = layers;
228
225
  }
229
226
  initLayer(layer) {
230
227
  if (layer.attachToMap) {
@@ -293,7 +290,6 @@ class BasicMap extends PureComponent {
293
290
  }
294
291
  render() {
295
292
  const { className, tabIndex, ariaLabel, style } = this.props;
296
- const { node } = this.state;
297
293
  return /* @__PURE__ */ React.createElement(
298
294
  "div",
299
295
  {
@@ -303,18 +299,7 @@ class BasicMap extends PureComponent {
303
299
  "aria-label": ariaLabel,
304
300
  tabIndex,
305
301
  style
306
- },
307
- /* @__PURE__ */ React.createElement(
308
- ResizeHandler,
309
- {
310
- maxHeightBrkpts: null,
311
- maxWidthBrkpts: null,
312
- observe: node,
313
- onResize: () => {
314
- this.map.updateSize();
315
- }
316
- }
317
- )
302
+ }
318
303
  );
319
304
  }
320
305
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/BasicMap/BasicMap.js"],
4
- "sourcesContent": ["import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport { defaults as defaultInteractions } from 'ol/interaction';\nimport { equals } from 'ol/extent';\nimport OLMap from 'ol/Map';\nimport OLCollection from 'ol/Collection';\nimport View from 'ol/View';\nimport { unByKey } from 'ol/Observable';\nimport Interaction from 'ol/interaction/Interaction';\nimport { Layer } from 'mobility-toolbox-js/ol';\nimport ResizeHandler from '../ResizeHandler';\n\nconst propTypes = {\n /** Map animation options */\n animationOptions: PropTypes.shape({\n center: PropTypes.arrayOf(PropTypes.number),\n resolution: PropTypes.number,\n zoom: PropTypes.number,\n }),\n\n /** Center of the [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html). */\n center: PropTypes.arrayOf(PropTypes.number),\n\n /** Class name of the map container */\n className: PropTypes.string,\n\n /** Map extent */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /** Openlayers [fit options](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit) when extent is updated */\n fitOptions: PropTypes.object,\n\n /** Array of [ol/interaction](https://openlayers.org/en/latest/apidoc/module-ol_interaction_Interaction-Interaction.html). */\n interactions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.instanceOf(Interaction)),\n PropTypes.instanceOf(OLCollection),\n ]),\n\n /** Array of [mobility-toolbox-js layers](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers) to display. */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is clicked.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The singleclick [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:singleclick).\n */\n onFeaturesClick: PropTypes.func,\n\n /**\n * Optional options to pass on feature click. Passed to ol's 'getFeaturesAtPixel' method.\n * https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html#getFeaturesAtPixel\n */\n featuresClickOptions: PropTypes.shape({\n layerFilter: PropTypes.func,\n hitTolerance: PropTypes.number,\n checkWrapped: PropTypes.bool,\n }),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is hovered.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The pointermove [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:pointermove).\n */\n onFeaturesHover: PropTypes.func,\n\n /**\n * Callback when the map was moved.\n * @param {ol.MapEvent} event The movend [ol/MapEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:moveend).\n */\n onMapMoved: PropTypes.func,\n\n /** Map resolution */\n resolution: PropTypes.number,\n\n /** The tabIndex of the map. */\n tabIndex: PropTypes.number,\n\n /** The style of the map. */\n style: PropTypes.object,\n\n /** HTML aria-label. */\n ariaLabel: PropTypes.string,\n\n /** [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html) constructor options */\n viewOptions: PropTypes.shape({\n minZoom: PropTypes.number,\n maxZoom: PropTypes.number,\n extent: PropTypes.array,\n projection: PropTypes.string,\n }),\n\n /** Map zoom level */\n zoom: PropTypes.number,\n};\n\nconst defaultProps = {\n animationOptions: undefined,\n center: [0, 0],\n className: 'rs-map',\n extent: undefined,\n fitOptions: {\n duration: 1000,\n padding: [20, 20, 20, 20],\n maxZoom: 23,\n },\n style: undefined,\n interactions: null,\n layers: [],\n map: null,\n onFeaturesClick: undefined,\n featuresClickOptions: {\n hitTolerance: 0,\n },\n onFeaturesHover: undefined,\n onMapMoved: undefined,\n resolution: undefined,\n tabIndex: undefined,\n ariaLabel: 'map',\n viewOptions: {\n minZoom: 0,\n maxZoom: 22,\n extent: undefined,\n projection: 'EPSG:3857',\n },\n zoom: 1,\n};\n\n/**\n * The BasicMap component renders an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n *\n * The map's view is created with the following parameters for the view:\n * - projection: 'EPSG:3857'\n * - zoom: 0\n * - minZoom: 0\n * - maxZoom: 22\n *\n * These options can be overridden using the viewOptions property.\n */\nclass BasicMap extends PureComponent {\n constructor(props) {\n super(props);\n const { map, interactions } = this.props;\n\n this.map =\n map ||\n new OLMap({\n controls: [],\n interactions:\n interactions ||\n defaultInteractions({\n altShiftDragRotate: false,\n pinchRotate: false,\n }),\n });\n\n this.state = {\n node: null,\n };\n\n this.layers = [];\n this.moveEndRef = null;\n this.singleClickRef = null;\n this.pointerMoveRef = null;\n this.setNode = this.setNode.bind(this);\n }\n\n componentDidMount() {\n const { layers, extent, viewOptions, center, zoom, resolution } =\n this.props;\n const { node } = this.state;\n this.map.setTarget(node);\n\n // We set the view here otherwise the map is not correctly zoomed.\n this.map.setView(new View({ ...viewOptions, center, zoom, resolution }));\n\n // // Since ol 6.1.0 touch-action is set to auto and creates a bad navigation experience on mobile,\n // // so we have to force it to none for mobile.\n // // https://github.com/openlayers/openlayers/pull/10187/files\n const viewPort = this.map.getViewport();\n viewPort.style.touchAction = 'none';\n viewPort.style.msTouchAction = 'none';\n viewPort.setAttribute('touch-action', 'none');\n\n // Fit only work if the map has a size.\n if (this.map.getSize() && extent) {\n this.map.getView().fit(extent);\n }\n\n this.setLayers(layers);\n this.listenMoveEnd();\n this.listenSingleClick();\n this.listenPointerMove();\n }\n\n componentDidUpdate(prevProps, prevState) {\n const {\n animationOptions,\n center,\n extent,\n fitOptions,\n layers,\n resolution,\n viewOptions,\n zoom,\n onMapMoved,\n onFeaturesClick,\n onFeaturesHover,\n } = this.props;\n const { node } = this.state;\n\n if (prevState.node !== node) {\n if (zoom) {\n this.map.getView().setZoom(zoom);\n }\n\n if (resolution) {\n this.map.getView().setResolution(resolution);\n }\n this.map.setTarget(node);\n\n // When the node is set we reinitialize the extent with the extent property.\n if (!prevState.node && node && extent) {\n this.map.getView().fit(extent);\n }\n }\n\n if (prevProps.layers !== layers) {\n this.setLayers(layers, prevProps.layers);\n }\n\n // Creates a new view if necessary before updating the others prop.\n if (\n viewOptions &&\n JSON.stringify(viewOptions) !== JSON.stringify(prevProps.viewOptions)\n ) {\n // Re-create a view, ol doesn't provide any method to setExtent of view.\n this.map.setView(\n new View({\n ...viewOptions,\n center,\n resolution,\n zoom,\n }),\n );\n }\n\n const view = this.map.getView();\n\n if (animationOptions && prevProps.animationOptions !== animationOptions) {\n view.animate(animationOptions);\n }\n\n if (prevProps.center !== center) {\n view.setCenter(center);\n }\n\n if (zoom !== prevProps.zoom) {\n view.setZoom(zoom);\n }\n\n if (resolution !== prevProps.resolution) {\n view.setResolution(resolution);\n }\n\n if (extent && !equals(extent, prevProps.extent || [])) {\n view.fit(extent, fitOptions);\n }\n\n if (onMapMoved !== prevProps.onMapMoved) {\n this.listenMoveEnd();\n }\n\n if (onFeaturesClick !== prevProps.onFeaturesClick) {\n this.listenSingleClick();\n }\n\n if (onFeaturesHover !== prevProps.onFeaturesHover) {\n this.listenPointerMove();\n }\n }\n\n componentWillUnmount() {\n unByKey([this.moveEndRef, this.singleClickRef, this.pointerMoveRef]);\n }\n\n setNode(node) {\n this.setState({ node });\n }\n\n setLayers(layers = [], prevLayers = []) {\n for (let i = 0; i < prevLayers.length; i += 1) {\n this.terminateLayer(prevLayers[i]);\n }\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n this.layers = layers;\n }\n\n initLayer(layer) {\n if (layer.attachToMap) {\n layer.attachToMap(this.map);\n }\n\n if (layer.init) {\n layer.init(this.map);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n !this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.addLayer(layer.olLayer);\n }\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n terminateLayer(layer) {\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.terminateLayer(layers[i]);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.removeLayer(layer.olLayer);\n }\n\n if (layer.terminate) {\n layer.terminate(this.map);\n }\n\n if (layer.detachFromMap) {\n layer.detachFromMap(this.map);\n }\n }\n\n listenMoveEnd() {\n const { onMapMoved } = this.props;\n unByKey(this.moveEndRef);\n\n if (!onMapMoved) {\n return;\n }\n\n this.moveEndRef = this.map.on('moveend', (evt) => {\n return onMapMoved(evt);\n });\n }\n\n listenSingleClick() {\n const { onFeaturesClick, featuresClickOptions } = this.props;\n unByKey(this.singleClickRef);\n\n if (!onFeaturesClick) {\n return;\n }\n\n this.singleClickRef = this.map.on('singleclick', (evt) => {\n const features = evt.map.getFeaturesAtPixel(\n evt.pixel,\n featuresClickOptions,\n );\n onFeaturesClick(features || [], evt);\n });\n }\n\n listenPointerMove() {\n const { onFeaturesHover } = this.props;\n unByKey(this.pointerMoveRef);\n\n if (!onFeaturesHover) {\n return;\n }\n\n this.pointerMoveRef = this.map.on('pointermove', (evt) => {\n const features = evt.map.getFeaturesAtPixel(evt.pixel);\n onFeaturesHover(features || [], evt);\n });\n }\n\n render() {\n const { className, tabIndex, ariaLabel, style } = this.props;\n const { node } = this.state;\n return (\n <div\n className={className}\n ref={this.setNode}\n role=\"presentation\"\n aria-label={ariaLabel}\n tabIndex={tabIndex}\n style={style}\n >\n <ResizeHandler\n maxHeightBrkpts={null}\n maxWidthBrkpts={null}\n observe={node}\n onResize={() => {\n this.map.updateSize();\n }}\n />\n </div>\n );\n }\n}\n\nBasicMap.propTypes = propTypes;\nBasicMap.defaultProps = defaultProps;\n\nexport default BasicMap;\n"],
5
- "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,SAAS,YAAY,2BAA2B;AAChD,SAAS,cAAc;AACvB,OAAO,WAAW;AAClB,OAAO,kBAAkB;AACzB,OAAO,UAAU;AACjB,SAAS,eAAe;AACxB,OAAO,iBAAiB;AACxB,SAAS,aAAa;AACtB,OAAO,mBAAmB;AAE1B,MAAM,YAAY;AAAA;AAAA,EAEhB,kBAAkB,UAAU,MAAM;AAAA,IAChC,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA,IAC1C,YAAY,UAAU;AAAA,IACtB,MAAM,UAAU;AAAA,EAClB,CAAC;AAAA;AAAA,EAGD,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA;AAAA,EAG1C,WAAW,UAAU;AAAA;AAAA,EAGrB,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA;AAAA,EAG1C,YAAY,UAAU;AAAA;AAAA,EAGtB,cAAc,UAAU,UAAU;AAAA,IAChC,UAAU,QAAQ,UAAU,WAAW,WAAW,CAAC;AAAA,IACnD,UAAU,WAAW,YAAY;AA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,IAAI,KAAK;AACtB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,KAAK,KAAK;AAAA,QACV,MAAK;AAAA,QACL,cAAY;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,iBAAiB;AAAA,UACjB,gBAAgB;AAAA,UAChB,SAAS;AAAA,UACT,UAAU,MAAM;AACd,iBAAK,IAAI,WAAW;AAAA,UACtB;AAAA;AAAA,MACF;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,SAAS,YAAY;AACrB,SAAS,eAAe;AAExB,eAAe;",
4
+ "sourcesContent": ["import React, { PureComponent } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { defaults as defaultInteractions } from \"ol/interaction\";\nimport { equals } from \"ol/extent\";\nimport OLMap from \"ol/Map\";\nimport OLCollection from \"ol/Collection\";\nimport View from \"ol/View\";\nimport { unByKey } from \"ol/Observable\";\nimport Interaction from \"ol/interaction/Interaction\";\nimport { Layer } from \"mobility-toolbox-js/ol\";\n\nconst propTypes = {\n /** Map animation options */\n animationOptions: PropTypes.shape({\n center: PropTypes.arrayOf(PropTypes.number),\n resolution: PropTypes.number,\n zoom: PropTypes.number,\n }),\n\n /** Center of the [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html). */\n center: PropTypes.arrayOf(PropTypes.number),\n\n /** Class name of the map container */\n className: PropTypes.string,\n\n /** Map extent */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /** Openlayers [fit options](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit) when extent is updated */\n fitOptions: PropTypes.object,\n\n /** Array of [ol/interaction](https://openlayers.org/en/latest/apidoc/module-ol_interaction_Interaction-Interaction.html). */\n interactions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.instanceOf(Interaction)),\n PropTypes.instanceOf(OLCollection),\n ]),\n\n /** Array of [mobility-toolbox-js layers](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers) to display. */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is clicked.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The singleclick [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:singleclick).\n */\n onFeaturesClick: PropTypes.func,\n\n /**\n * Optional options to pass on feature click. Passed to ol's 'getFeaturesAtPixel' method.\n * https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html#getFeaturesAtPixel\n */\n featuresClickOptions: PropTypes.shape({\n layerFilter: PropTypes.func,\n hitTolerance: PropTypes.number,\n checkWrapped: PropTypes.bool,\n }),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is hovered.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The pointermove [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:pointermove).\n */\n onFeaturesHover: PropTypes.func,\n\n /**\n * Callback when the map was moved.\n * @param {ol.MapEvent} event The movend [ol/MapEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:moveend).\n */\n onMapMoved: PropTypes.func,\n\n /** Map resolution */\n resolution: PropTypes.number,\n\n /** The tabIndex of the map. */\n tabIndex: PropTypes.number,\n\n /** The style of the map. */\n style: PropTypes.object,\n\n /** HTML aria-label. */\n ariaLabel: PropTypes.string,\n\n /** [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html) constructor options */\n viewOptions: PropTypes.shape({\n minZoom: PropTypes.number,\n maxZoom: PropTypes.number,\n extent: PropTypes.array,\n projection: PropTypes.string,\n }),\n\n /** Map zoom level */\n zoom: PropTypes.number,\n};\n\nconst defaultProps = {\n animationOptions: undefined,\n center: [0, 0],\n className: \"rs-map\",\n extent: undefined,\n fitOptions: {\n duration: 1000,\n padding: [20, 20, 20, 20],\n maxZoom: 23,\n },\n style: undefined,\n interactions: null,\n layers: [],\n map: null,\n onFeaturesClick: undefined,\n featuresClickOptions: {\n hitTolerance: 0,\n },\n onFeaturesHover: undefined,\n onMapMoved: undefined,\n resolution: undefined,\n tabIndex: undefined,\n ariaLabel: \"map\",\n viewOptions: {\n minZoom: 0,\n maxZoom: 22,\n extent: undefined,\n projection: \"EPSG:3857\",\n },\n zoom: 1,\n};\n\n/**\n * The BasicMap component renders an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n *\n * The map's view is created with the following parameters for the view:\n * - projection: 'EPSG:3857'\n * - zoom: 0\n * - minZoom: 0\n * - maxZoom: 22\n *\n * These options can be overridden using the viewOptions property.\n */\nclass BasicMap extends PureComponent {\n constructor(props) {\n super(props);\n const { map, interactions } = this.props;\n\n this.map =\n map ||\n new OLMap({\n controls: [],\n interactions:\n interactions ||\n defaultInteractions({\n altShiftDragRotate: false,\n pinchRotate: false,\n }),\n });\n\n this.state = {\n node: null,\n };\n\n this.moveEndRef = null;\n this.singleClickRef = null;\n this.pointerMoveRef = null;\n this.setNode = this.setNode.bind(this);\n }\n\n componentDidMount() {\n const { layers, extent, viewOptions, center, zoom, resolution } =\n this.props;\n const { node } = this.state;\n this.map.setTarget(node);\n\n // We set the view here otherwise the map is not correctly zoomed.\n this.map.setView(new View({ ...viewOptions, center, zoom, resolution }));\n\n // // Since ol 6.1.0 touch-action is set to auto and creates a bad navigation experience on mobile,\n // // so we have to force it to none for mobile.\n // // https://github.com/openlayers/openlayers/pull/10187/files\n const viewPort = this.map.getViewport();\n viewPort.style.touchAction = \"none\";\n viewPort.style.msTouchAction = \"none\";\n viewPort.setAttribute(\"touch-action\", \"none\");\n\n // Fit only work if the map has a size.\n if (this.map.getSize() && extent) {\n this.map.getView().fit(extent);\n }\n\n this.setLayers(layers);\n this.listenMoveEnd();\n this.listenSingleClick();\n this.listenPointerMove();\n }\n\n componentDidUpdate(prevProps, prevState) {\n const {\n animationOptions,\n center,\n extent,\n fitOptions,\n layers,\n resolution,\n viewOptions,\n zoom,\n onMapMoved,\n onFeaturesClick,\n onFeaturesHover,\n } = this.props;\n const { node } = this.state;\n\n if (prevState.node !== node) {\n if (zoom) {\n this.map.getView().setZoom(zoom);\n }\n\n if (resolution) {\n this.map.getView().setResolution(resolution);\n }\n this.map.setTarget(node);\n\n // When the node is set we reinitialize the extent with the extent property.\n if (!prevState.node && node && extent) {\n this.map.getView().fit(extent);\n }\n }\n\n if (prevProps.layers !== layers) {\n this.setLayers(layers, prevProps.layers);\n }\n\n // Creates a new view if necessary before updating the others prop.\n if (\n viewOptions &&\n JSON.stringify(viewOptions) !== JSON.stringify(prevProps.viewOptions)\n ) {\n // Re-create a view, ol doesn't provide any method to setExtent of view.\n this.map.setView(\n new View({\n ...viewOptions,\n center,\n resolution,\n zoom,\n }),\n );\n }\n\n const view = this.map.getView();\n\n if (animationOptions && prevProps.animationOptions !== animationOptions) {\n view.animate(animationOptions);\n }\n\n if (prevProps.center !== center) {\n view.setCenter(center);\n }\n\n if (zoom !== prevProps.zoom) {\n view.setZoom(zoom);\n }\n\n if (resolution !== prevProps.resolution) {\n view.setResolution(resolution);\n }\n\n if (extent && !equals(extent, prevProps.extent || [])) {\n view.fit(extent, fitOptions);\n }\n\n if (onMapMoved !== prevProps.onMapMoved) {\n this.listenMoveEnd();\n }\n\n if (onFeaturesClick !== prevProps.onFeaturesClick) {\n this.listenSingleClick();\n }\n\n if (onFeaturesHover !== prevProps.onFeaturesHover) {\n this.listenPointerMove();\n }\n }\n\n componentWillUnmount() {\n unByKey([this.moveEndRef, this.singleClickRef, this.pointerMoveRef]);\n }\n\n setNode(node) {\n this.setState({ node });\n }\n\n setLayers(layers = [], prevLayers = []) {\n for (let i = 0; i < prevLayers.length; i += 1) {\n this.terminateLayer(prevLayers[i]);\n }\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n initLayer(layer) {\n if (layer.attachToMap) {\n layer.attachToMap(this.map);\n }\n\n if (layer.init) {\n layer.init(this.map);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n !this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.addLayer(layer.olLayer);\n }\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n terminateLayer(layer) {\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.terminateLayer(layers[i]);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.removeLayer(layer.olLayer);\n }\n\n if (layer.terminate) {\n layer.terminate(this.map);\n }\n\n if (layer.detachFromMap) {\n layer.detachFromMap(this.map);\n }\n }\n\n listenMoveEnd() {\n const { onMapMoved } = this.props;\n unByKey(this.moveEndRef);\n\n if (!onMapMoved) {\n return;\n }\n\n this.moveEndRef = this.map.on(\"moveend\", (evt) => {\n return onMapMoved(evt);\n });\n }\n\n listenSingleClick() {\n const { onFeaturesClick, featuresClickOptions } = this.props;\n unByKey(this.singleClickRef);\n\n if (!onFeaturesClick) {\n return;\n }\n\n this.singleClickRef = this.map.on(\"singleclick\", (evt) => {\n const features = evt.map.getFeaturesAtPixel(\n evt.pixel,\n featuresClickOptions,\n );\n onFeaturesClick(features || [], evt);\n });\n }\n\n listenPointerMove() {\n const { onFeaturesHover } = this.props;\n unByKey(this.pointerMoveRef);\n\n if (!onFeaturesHover) {\n return;\n }\n\n this.pointerMoveRef = this.map.on(\"pointermove\", (evt) => {\n const features = evt.map.getFeaturesAtPixel(evt.pixel);\n onFeaturesHover(features || [], evt);\n });\n }\n\n render() {\n const { className, tabIndex, ariaLabel, style } = this.props;\n return (\n <div\n className={className}\n ref={this.setNode}\n role=\"presentation\"\n aria-label={ariaLabel}\n tabIndex={tabIndex}\n style={style}\n />\n );\n }\n}\n\nBasicMap.propTypes = propTypes;\nBasicMap.defaultProps = defaultProps;\n\nexport default BasicMap;\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,SAAS,YAAY,2BAA2B;AAChD,SAAS,cAAc;AACvB,OAAO,WAAW;AAClB,OAAO,kBAAkB;AACzB,OAAO,UAAU;AACjB,SAAS,eAAe;AACxB,OAAO,iBAAiB;AACxB,SAAS,aAAa;AAEtB,MAAM,YAAY;AAAA;AAAA,EAEhB,kBAAkB,UAAU,MAAM;AAAA,IAChC,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA,IAC1C,YAAY,UAAU;AAAA,IACtB,MAAM,UAAU;AAAA,EAClB,CAAC;AAAA;AAAA,EAGD,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA;AAAA,EAG1C,WAAW,UAAU;AAAA;AAAA,EAGrB,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA;AAAA,EAG1C,YAAY,UAAU;AAAA;AAAA,EAGtB,cAAc,UAAU,UAAU;AAAA,IAChC,UAAU,QAAQ,UAAU,WAAW,WAAW,CAAC;AAAA,IACnD,UAAU,WAAW,YAAY;AAAA,EACnC,CAAC;AAAA;AAAA,EAGD,QAAQ,UAAU,QAAQ,UAAU,WAAW,KAAK,CAAC;AAAA;AAAA,EAGrD,KAAK,UAAU,WAAW,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/B,iBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3B,sBAAsB,UAAU,MAAM;AAAA,IACpC,aAAa,UAAU;AAAA,IACvB,cAAc,UAAU;AAAA,IACxB,cAAc,UAA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AAU;AAEvB,QAAI,CAAC,YAAY;AACf;AAAA,IACF;AAEA,SAAK,aAAa,KAAK,IAAI,GAAG,WAAW,CAAC,QAAQ;AAChD,aAAO,WAAW,GAAG;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,oBAAoB;AAClB,UAAM,EAAE,iBAAiB,qBAAqB,IAAI,KAAK;AACvD,YAAQ,KAAK,cAAc;AAE3B,QAAI,CAAC,iBAAiB;AACpB;AAAA,IACF;AAEA,SAAK,iBAAiB,KAAK,IAAI,GAAG,eAAe,CAAC,QAAQ;AACxD,YAAM,WAAW,IAAI,IAAI;AAAA,QACvB,IAAI;AAAA,QACJ;AAAA,MACF;AACA,sBAAgB,YAAY,CAAC,GAAG,GAAG;AAAA,IACrC,CAAC;AAAA,EACH;AAAA,EAEA,oBAAoB;AAClB,UAAM,EAAE,gBAAgB,IAAI,KAAK;AACjC,YAAQ,KAAK,cAAc;AAE3B,QAAI,CAAC,iBAAiB;AACpB;AAAA,IACF;AAEA,SAAK,iBAAiB,KAAK,IAAI,GAAG,eAAe,CAAC,QAAQ;AACxD,YAAM,WAAW,IAAI,IAAI,mBAAmB,IAAI,KAAK;AACrD,sBAAgB,YAAY,CAAC,GAAG,GAAG;AAAA,IACrC,CAAC;AAAA,EACH;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,WAAW,UAAU,WAAW,MAAM,IAAI,KAAK;AACvD,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,KAAK,KAAK;AAAA,QACV,MAAK;AAAA,QACL,cAAY;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,SAAS,YAAY;AACrB,SAAS,eAAe;AAExB,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/BasicMap/index.js"],
4
- "sourcesContent": ["export { default } from './BasicMap';\n"],
4
+ "sourcesContent": ["export { default } from \"./BasicMap\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/CanvasSaveButton/CanvasSaveButton.js"],
4
- "sourcesContent": ["/* eslint-disable no-param-reassign */\nimport React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport OLMap from 'ol/Map';\nimport { getTopLeft, getBottomRight } from 'ol/extent';\nimport NorthArrowSimple from '../../images/northArrow.url.svg';\nimport NorthArrowCircle from '../../images/northArrowCircle.url.svg';\n\nconst extraDataImgPropType = PropTypes.shape({\n src: PropTypes.string,\n width: PropTypes.number,\n height: PropTypes.number,\n rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),\n circled: PropTypes.bool,\n});\n\n// support server-side rendering where `Element` will not be defined\nconst CanvasPatternType =\n typeof CanvasPattern === 'undefined' ? Function : CanvasPattern;\n\nconst propTypes = {\n /**\n * Automatically download the image saved.\n */\n autoDownload: PropTypes.bool,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.node,\n\n /**\n * Output format of the image.\n */\n format: PropTypes.oneOf(['image/jpeg', 'image/png']),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Extent for the export. If no extent is given, the whole map is exported.\n */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).\n * If no coordinates and no extent are given, the whole map is exported.\n * This property must be used to export rotated map.\n * If you don't need to export rotated map the extent property can be used as well.\n * If extent is specified, coordinates property is ignored.\n */\n coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n\n /**\n * Scale the map for better quality. Possible values: 1, 2 or 3.\n * WARNING: The tiled layer with a WMTS or XYZ source must provides an url\n * for each scale in the config file.\n */\n scale: PropTypes.number,\n\n /**\n * Function called before the dowload process begins.\n */\n onSaveStart: PropTypes.func,\n\n /**\n * Function called after the dowload process ends.\n *\n * @param {object} error Error message the process fails.\n */\n onSaveEnd: PropTypes.func,\n\n /**\n * Extra data, such as copyright, north arrow configuration.\n * All extra data is optional.\n *\n * Example 1:\n *\n {\n copyright: {\n text: 'Example copyright', // Copyright text or function\n font: '10px Arial', // Font, default is '12px Arial'\n fillStyle: 'blue', // Fill style, default is 'black'\n },\n northArrow, // True if the north arrow\n // should be placed with default configuration\n // (default image, rotation=0, circled=false)\n }\n * Example 2:\n *\n {\n northArrow: {\n src: NorthArrowCustom,\n width: 60, // Width in px, default is 80\n height: 100, // Height in px, default is 80\n rotation: 25, // Absolute rotation in degrees as number or function\n\n }\n }\n * Example 3:\n *\n {\n copyright: {\n text: () => { // Copyright as function\n return this.copyright;\n },\n },\n northArrow: {\n rotation: () => { // Rotation as function\n return NorthArrow.radToDeg(this.map.getView().getRotation());\n },\n circled, // Display circle around the north arrow (Does not work for custom src)\n },\n }\n */\n extraData: PropTypes.shape({\n logo: extraDataImgPropType,\n northArrow: extraDataImgPropType,\n qrCode: extraDataImgPropType,\n copyright: PropTypes.shape({\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n font: PropTypes.string,\n fillStyle: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.instanceOf(CanvasPatternType),\n ]),\n background: PropTypes.bool,\n }),\n }),\n};\n\nconst defaultProps = {\n autoDownload: true,\n children: null,\n map: null,\n format: 'image/png',\n extent: null,\n extraData: null,\n coordinates: null,\n scale: 1,\n onSaveStart: (map) => {\n return Promise.resolve(map);\n },\n onSaveEnd: () => {},\n};\n\n/**\n * The CanvasSaveButton component creates a button to save\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)\n * canvas as an image.\n */\nclass CanvasSaveButton extends PureComponent {\n constructor(props) {\n super(props);\n this.padding = 5;\n }\n\n static getMargin(destCanvas) {\n const newMargin = destCanvas.width / 100; // 1% of the canvas width\n return newMargin;\n }\n\n onClick(evt) {\n const { map, onSaveStart, onSaveEnd, autoDownload } = this.props;\n if (window.navigator.msSaveBlob) {\n // ie only\n evt.preventDefault();\n evt.stopPropagation();\n }\n onSaveStart(map).then((mapToExport) => {\n return this.createCanvasImage(mapToExport || map)\n .then((canvas) => {\n if (autoDownload) {\n this.downloadCanvasImage(canvas).then((blob) => {\n onSaveEnd(mapToExport, canvas, blob);\n });\n } else {\n onSaveEnd(mapToExport, canvas);\n }\n })\n .catch((err) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n onSaveEnd(mapToExport, err);\n });\n });\n }\n\n getDownloadImageName() {\n const { format } = this.props;\n const fileExt = format === 'image/jpeg' ? 'jpg' : 'png';\n return (\n `${window.document.title.replace(/ /g, '_').toLowerCase()}` +\n `.${fileExt}`\n );\n }\n\n // Ensure the font size fita with the image width.\n decreaseFontSize(destContext, maxWidth, copyright, scale) {\n const minFontSize = 8;\n let sizeMatch;\n let fontSize;\n do {\n sizeMatch = destContext.font.match(/[0-9]+(?:\\.[0-9]+)?(px)/i);\n fontSize = parseInt(sizeMatch[0].replace(sizeMatch[1], ''), 10);\n\n // eslint-disable-next-line no-param-reassign\n destContext.font = destContext.font.replace(fontSize, fontSize - 1);\n\n if (fontSize - 1 === minFontSize) {\n this.multilineCopyright = true;\n }\n } while (\n fontSize - 1 > minFontSize &&\n destContext.measureText(copyright).width * scale > maxWidth\n );\n\n return destContext.font;\n }\n\n // eslint-disable-next-line class-methods-use-this\n drawTextBackground(\n destContext,\n textMeasure,\n textX,\n textY,\n padding,\n styleOptions = {},\n ) {\n /// get width of text\n const { width, height, actualBoundingBoxAscent } = textMeasure;\n destContext.save();\n // Dflt is a white background\n destContext.fillStyle = 'rgba(255,255,255,.8)';\n\n // To simplify usability the user could pass a boolean to use only default values.\n if (typeof styleOptions === 'object') {\n Object.entries(styleOptions).forEach(([key, value]) => {\n destContext[key] = value;\n });\n }\n\n /// draw background rect assuming height of font\n destContext.fillRect(\n textX - padding,\n textY - actualBoundingBoxAscent - padding,\n width + padding * 2,\n height + padding * 2,\n );\n destContext.restore();\n }\n\n drawCopyright(destContext, destCanvas, maxWidth) {\n const { extraData, scale } = this.props;\n const { text, font, fillStyle, background } = extraData.copyright;\n let copyright = typeof text === 'function' ? text() : text;\n\n if (Array.isArray(copyright)) {\n copyright = copyright.join();\n }\n\n destContext.save();\n destContext.scale(scale, scale);\n destContext.font = font || '12px Arial';\n destContext.font = this.decreaseFontSize(\n destContext,\n maxWidth - this.padding,\n copyright,\n scale,\n );\n\n destContext.scale(scale, scale);\n destContext.fillStyle = fillStyle || 'black';\n\n // We search if the display on 2 line is necessary\n let firstLine = copyright;\n const wordNumber = copyright.split(' ').length;\n\n // If the text is bigger than the max width we split it into 2 lines\n if (this.multilineCopyright) {\n for (let i = 0; i < wordNumber; i += 1) {\n firstLine = firstLine.substring(0, firstLine.lastIndexOf(' '));\n // Stop removing word when fits within one line.\n if (\n destContext.measureText(firstLine).width * scale <\n maxWidth - this.padding\n ) {\n break;\n }\n }\n }\n const secondLine = copyright.replace(firstLine, '');\n\n // Draw first line (line break isn't supported for fillText).\n const textX = this.margin;\n let textMeasure = destContext.measureText(firstLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n let firstLineY = destCanvas.height / scale - this.padding;\n const secondLineY = firstLineY;\n const paddingBetweenLines = 3;\n const paddingBackground = paddingBetweenLines / 2;\n\n if (secondLine) {\n firstLineY -= textMeasure.height + paddingBetweenLines;\n }\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n firstLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(firstLine, textX, firstLineY);\n\n // Draw second line.\n if (secondLine) {\n textMeasure = destContext.measureText(secondLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n secondLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(secondLine, textX, secondLineY);\n }\n\n const firstLineMetrics = destContext.measureText(firstLine);\n const secondLineMetrics = destContext.measureText(secondLine);\n const heightFirstLine =\n firstLineMetrics.actualBoundingBoxAscent +\n firstLineMetrics.actualBoundingBoxDescent;\n const heightSecondLine =\n secondLineMetrics.actualBoundingBoxAscent +\n secondLineMetrics.actualBoundingBoxDescent;\n this.copyrightY =\n destCanvas.height -\n (heightFirstLine + paddingBetweenLines + heightSecondLine) / 2;\n destContext.restore();\n }\n\n drawElement(data, destCanvas, previousItemSize = [0, 0], side = 'right') {\n const destContext = destCanvas.getContext('2d');\n const { scale } = this.props;\n const { src, width, height, rotation } = data;\n\n return new Promise((resolve) => {\n const img = new Image();\n img.crossOrigin = 'Anonymous';\n img.src = src;\n img.onload = () => {\n destContext.save();\n const elementWidth = (width || 80) * scale;\n const elementHeight = (height || 80) * scale;\n const left =\n side === 'left'\n ? this.margin + elementWidth / 2\n : destCanvas.width - this.margin - elementWidth / 2;\n const top =\n (side === 'left' && this.copyrightY\n ? this.copyrightY - 2 * this.padding\n : destCanvas.height) -\n this.margin -\n elementHeight / 2 -\n previousItemSize[1];\n\n destContext.translate(left, top);\n\n if (rotation) {\n const angle = typeof rotation === 'function' ? rotation() : rotation;\n destContext.rotate(angle * (Math.PI / 180));\n }\n\n destContext.drawImage(\n img,\n -elementWidth / 2,\n -elementHeight / 2,\n elementWidth,\n elementHeight,\n );\n destContext.restore();\n\n // Return the pixels width of the arrow and the margin right,\n // that must not be occupied by the copyright.\n resolve([\n elementWidth + 2 * this.padding,\n elementHeight + 2 * this.padding,\n ]);\n };\n\n img.onerror = () => {\n resolve();\n };\n });\n }\n\n calculatePixelsToExport(mapToExport) {\n const { extent, coordinates } = this.props;\n let firstCoordinate;\n let oppositeCoordinate;\n\n if (extent) {\n firstCoordinate = getTopLeft(extent);\n oppositeCoordinate = getBottomRight(extent);\n } else if (coordinates) {\n // In case of coordinates coming from DragBox interaction:\n // firstCoordinate is the first coordinate drawn by the user.\n // oppositeCoordinate is the coordinate of the point dragged by the user.\n [firstCoordinate, , oppositeCoordinate] = coordinates;\n }\n\n if (firstCoordinate && oppositeCoordinate) {\n const firstPixel = mapToExport.getPixelFromCoordinate(firstCoordinate);\n const oppositePixel =\n mapToExport.getPixelFromCoordinate(oppositeCoordinate);\n const pixelTopLeft = [\n firstPixel[0] <= oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] <= oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n const pixelBottomRight = [\n firstPixel[0] > oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n\n return {\n x: pixelTopLeft[0],\n y: pixelTopLeft[1],\n w: pixelBottomRight[0] - pixelTopLeft[0],\n h: pixelBottomRight[1] - pixelTopLeft[1],\n };\n }\n return null;\n }\n\n createCanvasImage(mapToExport) {\n const { extraData } = this.props;\n\n return new Promise((resolve) => {\n mapToExport.once('rendercomplete', () => {\n // Find all layer canvases and add it to dest canvas.\n const canvases = mapToExport\n .getTargetElement()\n .getElementsByTagName('canvas');\n\n // Create the canvas to export with the good size.\n let destCanvas;\n let destContext;\n\n // canvases is an HTMLCollection, we don't try to transform to array because some compilers like cra doesn't translate it right.\n for (let i = 0; i < canvases.length; i += 1) {\n const canvas = canvases[i];\n if (!canvas.width || !canvas.height) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const clip = this.calculatePixelsToExport(mapToExport) || {\n x: 0,\n y: 0,\n w: canvas.width,\n h: canvas.height,\n };\n\n if (!destCanvas) {\n destCanvas = document.createElement('canvas');\n destCanvas.width = clip.w;\n destCanvas.height = clip.h;\n destContext = destCanvas.getContext('2d');\n }\n\n // Draw canvas to the canvas to export.\n destContext.drawImage(\n canvas,\n clip.x,\n clip.y,\n clip.w,\n clip.h,\n 0,\n 0,\n destCanvas.width,\n destCanvas.height,\n );\n }\n\n this.margin = CanvasSaveButton.getMargin(destCanvas);\n\n // Custom info\n let logoPromise = Promise.resolve();\n if (destContext && extraData && extraData.logo) {\n logoPromise = this.drawElement(extraData.logo, destCanvas);\n }\n\n logoPromise.then((logoSize = [0, 0]) => {\n // North arrow\n let arrowPromise = Promise.resolve();\n if (destContext && extraData && extraData.northArrow) {\n arrowPromise = this.drawElement(\n {\n src: extraData.northArrow.circled\n ? NorthArrowCircle\n : NorthArrowSimple,\n ...extraData.northArrow,\n },\n destCanvas,\n logoSize,\n );\n }\n\n // Copyright\n arrowPromise.then((arrowSize = [0, 0]) => {\n const widestElement = Math.max(logoSize[0], arrowSize[0]);\n if (\n destContext &&\n extraData &&\n extraData.copyright &&\n extraData.copyright.text\n ) {\n const maxWidth = widestElement\n ? destContext.canvas.width - widestElement - this.margin\n : destContext.canvas.width;\n this.drawCopyright(destContext, destCanvas, maxWidth);\n }\n let qrCodePromise = Promise.resolve();\n if (destContext && extraData && extraData.qrCode) {\n qrCodePromise = this.drawElement(\n extraData.qrCode,\n destCanvas,\n undefined,\n 'left',\n );\n }\n qrCodePromise.then(() => {\n return resolve(destCanvas);\n });\n });\n });\n });\n mapToExport.renderSync();\n });\n }\n\n downloadCanvasImage(canvas) {\n // Use blob for large images\n const promise = new Promise((resolve) => {\n const { format } = this.props;\n if (/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())) {\n // ie 9 and 10\n const url = canvas.toDataURL(format);\n const w = window.open('about:blank', '');\n w.document.write(`<img src=\"${url}\" alt=\"from canvas\"/>`);\n resolve(url);\n }\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n let image;\n try {\n image = canvas.msToBlob();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n const blob = new Blob([image], {\n type: format,\n });\n resolve(blob);\n window.navigator.msSaveBlob(blob, this.getDownloadImageName());\n } else {\n canvas.toBlob((blob) => {\n const link = document.createElement('a');\n link.download = this.getDownloadImageName();\n link.href = URL.createObjectURL(blob);\n // append child to document for firefox to be able to download.\n document.body.appendChild(link);\n link.click();\n resolve(blob);\n }, format);\n }\n });\n return promise;\n }\n\n render() {\n const { children, ...other } = this.props;\n\n delete other.onSaveStart;\n delete other.onSaveEnd;\n delete other.extraData;\n delete other.extent;\n delete other.format;\n delete other.map;\n delete other.coordinates;\n delete other.autoDownload;\n delete other.scale;\n\n return (\n <div\n role=\"button\"\n className=\"rs-canvas-save-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={(e) => {\n return this.onClick(e);\n }}\n onKeyPress={(e) => {\n return e.which === 13 && this.onClick(e);\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nCanvasSaveButton.propTypes = propTypes;\nCanvasSaveButton.defaultProps = defaultProps;\n\nexport default CanvasSaveButton;\n"],
4
+ "sourcesContent": ["/* eslint-disable no-param-reassign */\nimport React, { PureComponent } from \"react\";\nimport PropTypes from \"prop-types\";\nimport OLMap from \"ol/Map\";\nimport { getTopLeft, getBottomRight } from \"ol/extent\";\nimport NorthArrowSimple from \"../../images/northArrow.url.svg\";\nimport NorthArrowCircle from \"../../images/northArrowCircle.url.svg\";\n\nconst extraDataImgPropType = PropTypes.shape({\n src: PropTypes.string,\n width: PropTypes.number,\n height: PropTypes.number,\n rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),\n circled: PropTypes.bool,\n});\n\n// support server-side rendering where `Element` will not be defined\nconst CanvasPatternType =\n typeof CanvasPattern === \"undefined\" ? Function : CanvasPattern;\n\nconst propTypes = {\n /**\n * Automatically download the image saved.\n */\n autoDownload: PropTypes.bool,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.node,\n\n /**\n * Output format of the image.\n */\n format: PropTypes.oneOf([\"image/jpeg\", \"image/png\"]),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Extent for the export. If no extent is given, the whole map is exported.\n */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).\n * If no coordinates and no extent are given, the whole map is exported.\n * This property must be used to export rotated map.\n * If you don't need to export rotated map the extent property can be used as well.\n * If extent is specified, coordinates property is ignored.\n */\n coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n\n /**\n * Scale the map for better quality. Possible values: 1, 2 or 3.\n * WARNING: The tiled layer with a WMTS or XYZ source must provides an url\n * for each scale in the config file.\n */\n scale: PropTypes.number,\n\n /**\n * Function called before the dowload process begins.\n */\n onSaveStart: PropTypes.func,\n\n /**\n * Function called after the dowload process ends.\n *\n * @param {object} error Error message the process fails.\n */\n onSaveEnd: PropTypes.func,\n\n /**\n * Extra data, such as copyright, north arrow configuration.\n * All extra data is optional.\n *\n * Example 1:\n *\n {\n copyright: {\n text: 'Example copyright', // Copyright text or function\n font: '10px Arial', // Font, default is '12px Arial'\n fillStyle: 'blue', // Fill style, default is 'black'\n },\n northArrow, // True if the north arrow\n // should be placed with default configuration\n // (default image, rotation=0, circled=false)\n }\n * Example 2:\n *\n {\n northArrow: {\n src: NorthArrowCustom,\n width: 60, // Width in px, default is 80\n height: 100, // Height in px, default is 80\n rotation: 25, // Absolute rotation in degrees as number or function\n\n }\n }\n * Example 3:\n *\n {\n copyright: {\n text: () => { // Copyright as function\n return this.copyright;\n },\n },\n northArrow: {\n rotation: () => { // Rotation as function\n return NorthArrow.radToDeg(this.map.getView().getRotation());\n },\n circled, // Display circle around the north arrow (Does not work for custom src)\n },\n }\n */\n extraData: PropTypes.shape({\n logo: extraDataImgPropType,\n northArrow: extraDataImgPropType,\n qrCode: extraDataImgPropType,\n copyright: PropTypes.shape({\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n font: PropTypes.string,\n fillStyle: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.instanceOf(CanvasPatternType),\n ]),\n background: PropTypes.bool,\n }),\n }),\n};\n\nconst defaultProps = {\n autoDownload: true,\n children: null,\n map: null,\n format: \"image/png\",\n extent: null,\n extraData: null,\n coordinates: null,\n scale: 1,\n onSaveStart: (map) => {\n return Promise.resolve(map);\n },\n onSaveEnd: () => {},\n};\n\n/**\n * The CanvasSaveButton component creates a button to save\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)\n * canvas as an image.\n */\nclass CanvasSaveButton extends PureComponent {\n constructor(props) {\n super(props);\n this.padding = 5;\n }\n\n static getMargin(destCanvas) {\n const newMargin = destCanvas.width / 100; // 1% of the canvas width\n return newMargin;\n }\n\n onClick(evt) {\n const { map, onSaveStart, onSaveEnd, autoDownload } = this.props;\n if (window.navigator.msSaveBlob) {\n // ie only\n evt.preventDefault();\n evt.stopPropagation();\n }\n onSaveStart(map).then((mapToExport) => {\n return this.createCanvasImage(mapToExport || map)\n .then((canvas) => {\n if (autoDownload) {\n this.downloadCanvasImage(canvas).then((blob) => {\n onSaveEnd(mapToExport, canvas, blob);\n });\n } else {\n onSaveEnd(mapToExport, canvas);\n }\n })\n .catch((err) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n onSaveEnd(mapToExport, err);\n });\n });\n }\n\n getDownloadImageName() {\n const { format } = this.props;\n const fileExt = format === \"image/jpeg\" ? \"jpg\" : \"png\";\n return (\n `${window.document.title.replace(/ /g, \"_\").toLowerCase()}` +\n `.${fileExt}`\n );\n }\n\n // Ensure the font size fita with the image width.\n decreaseFontSize(destContext, maxWidth, copyright, scale) {\n const minFontSize = 8;\n let sizeMatch;\n let fontSize;\n do {\n sizeMatch = destContext.font.match(/[0-9]+(?:\\.[0-9]+)?(px)/i);\n fontSize = parseInt(sizeMatch[0].replace(sizeMatch[1], \"\"), 10);\n\n // eslint-disable-next-line no-param-reassign\n destContext.font = destContext.font.replace(fontSize, fontSize - 1);\n\n if (fontSize - 1 === minFontSize) {\n this.multilineCopyright = true;\n }\n } while (\n fontSize - 1 > minFontSize &&\n destContext.measureText(copyright).width * scale > maxWidth\n );\n\n return destContext.font;\n }\n\n // eslint-disable-next-line class-methods-use-this\n drawTextBackground(\n destContext,\n textMeasure,\n textX,\n textY,\n padding,\n styleOptions = {},\n ) {\n /// get width of text\n const { width, height, actualBoundingBoxAscent } = textMeasure;\n destContext.save();\n // Dflt is a white background\n destContext.fillStyle = \"rgba(255,255,255,.8)\";\n\n // To simplify usability the user could pass a boolean to use only default values.\n if (typeof styleOptions === \"object\") {\n Object.entries(styleOptions).forEach(([key, value]) => {\n destContext[key] = value;\n });\n }\n\n /// draw background rect assuming height of font\n destContext.fillRect(\n textX - padding,\n textY - actualBoundingBoxAscent - padding,\n width + padding * 2,\n height + padding * 2,\n );\n destContext.restore();\n }\n\n drawCopyright(destContext, destCanvas, maxWidth) {\n const { extraData, scale } = this.props;\n const { text, font, fillStyle, background } = extraData.copyright;\n let copyright = typeof text === \"function\" ? text() : text;\n\n if (Array.isArray(copyright)) {\n copyright = copyright.join();\n }\n\n destContext.save();\n destContext.scale(scale, scale);\n destContext.font = font || \"12px Arial\";\n destContext.font = this.decreaseFontSize(\n destContext,\n maxWidth - this.padding,\n copyright,\n scale,\n );\n\n destContext.scale(scale, scale);\n destContext.fillStyle = fillStyle || \"black\";\n\n // We search if the display on 2 line is necessary\n let firstLine = copyright;\n const wordNumber = copyright.split(\" \").length;\n\n // If the text is bigger than the max width we split it into 2 lines\n if (this.multilineCopyright) {\n for (let i = 0; i < wordNumber; i += 1) {\n firstLine = firstLine.substring(0, firstLine.lastIndexOf(\" \"));\n // Stop removing word when fits within one line.\n if (\n destContext.measureText(firstLine).width * scale <\n maxWidth - this.padding\n ) {\n break;\n }\n }\n }\n const secondLine = copyright.replace(firstLine, \"\");\n\n // Draw first line (line break isn't supported for fillText).\n const textX = this.margin;\n let textMeasure = destContext.measureText(firstLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n let firstLineY = destCanvas.height / scale - this.padding;\n const secondLineY = firstLineY;\n const paddingBetweenLines = 3;\n const paddingBackground = paddingBetweenLines / 2;\n\n if (secondLine) {\n firstLineY -= textMeasure.height + paddingBetweenLines;\n }\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n firstLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(firstLine, textX, firstLineY);\n\n // Draw second line.\n if (secondLine) {\n textMeasure = destContext.measureText(secondLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n secondLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(secondLine, textX, secondLineY);\n }\n\n const firstLineMetrics = destContext.measureText(firstLine);\n const secondLineMetrics = destContext.measureText(secondLine);\n const heightFirstLine =\n firstLineMetrics.actualBoundingBoxAscent +\n firstLineMetrics.actualBoundingBoxDescent;\n const heightSecondLine =\n secondLineMetrics.actualBoundingBoxAscent +\n secondLineMetrics.actualBoundingBoxDescent;\n this.copyrightY =\n destCanvas.height -\n (heightFirstLine + paddingBetweenLines + heightSecondLine) / 2;\n destContext.restore();\n }\n\n drawElement(data, destCanvas, previousItemSize = [0, 0], side = \"right\") {\n const destContext = destCanvas.getContext(\"2d\");\n const { scale } = this.props;\n const { src, width, height, rotation } = data;\n\n return new Promise((resolve) => {\n const img = new Image();\n img.crossOrigin = \"Anonymous\";\n img.src = src;\n img.onload = () => {\n destContext.save();\n const elementWidth = (width || 80) * scale;\n const elementHeight = (height || 80) * scale;\n const left =\n side === \"left\"\n ? this.margin + elementWidth / 2\n : destCanvas.width - this.margin - elementWidth / 2;\n const top =\n (side === \"left\" && this.copyrightY\n ? this.copyrightY - 2 * this.padding\n : destCanvas.height) -\n this.margin -\n elementHeight / 2 -\n previousItemSize[1];\n\n destContext.translate(left, top);\n\n if (rotation) {\n const angle = typeof rotation === \"function\" ? rotation() : rotation;\n destContext.rotate(angle * (Math.PI / 180));\n }\n\n destContext.drawImage(\n img,\n -elementWidth / 2,\n -elementHeight / 2,\n elementWidth,\n elementHeight,\n );\n destContext.restore();\n\n // Return the pixels width of the arrow and the margin right,\n // that must not be occupied by the copyright.\n resolve([\n elementWidth + 2 * this.padding,\n elementHeight + 2 * this.padding,\n ]);\n };\n\n img.onerror = () => {\n resolve();\n };\n });\n }\n\n calculatePixelsToExport(mapToExport) {\n const { extent, coordinates } = this.props;\n let firstCoordinate;\n let oppositeCoordinate;\n\n if (extent) {\n firstCoordinate = getTopLeft(extent);\n oppositeCoordinate = getBottomRight(extent);\n } else if (coordinates) {\n // In case of coordinates coming from DragBox interaction:\n // firstCoordinate is the first coordinate drawn by the user.\n // oppositeCoordinate is the coordinate of the point dragged by the user.\n [firstCoordinate, , oppositeCoordinate] = coordinates;\n }\n\n if (firstCoordinate && oppositeCoordinate) {\n const firstPixel = mapToExport.getPixelFromCoordinate(firstCoordinate);\n const oppositePixel =\n mapToExport.getPixelFromCoordinate(oppositeCoordinate);\n const pixelTopLeft = [\n firstPixel[0] <= oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] <= oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n const pixelBottomRight = [\n firstPixel[0] > oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n\n return {\n x: pixelTopLeft[0],\n y: pixelTopLeft[1],\n w: pixelBottomRight[0] - pixelTopLeft[0],\n h: pixelBottomRight[1] - pixelTopLeft[1],\n };\n }\n return null;\n }\n\n createCanvasImage(mapToExport) {\n const { extraData } = this.props;\n\n return new Promise((resolve) => {\n mapToExport.once(\"rendercomplete\", () => {\n // Find all layer canvases and add it to dest canvas.\n const canvases = mapToExport\n .getTargetElement()\n .getElementsByTagName(\"canvas\");\n\n // Create the canvas to export with the good size.\n let destCanvas;\n let destContext;\n\n // canvases is an HTMLCollection, we don't try to transform to array because some compilers like cra doesn't translate it right.\n for (let i = 0; i < canvases.length; i += 1) {\n const canvas = canvases[i];\n if (!canvas.width || !canvas.height) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const clip = this.calculatePixelsToExport(mapToExport) || {\n x: 0,\n y: 0,\n w: canvas.width,\n h: canvas.height,\n };\n\n if (!destCanvas) {\n destCanvas = document.createElement(\"canvas\");\n destCanvas.width = clip.w;\n destCanvas.height = clip.h;\n destContext = destCanvas.getContext(\"2d\");\n }\n\n // Draw canvas to the canvas to export.\n destContext.drawImage(\n canvas,\n clip.x,\n clip.y,\n clip.w,\n clip.h,\n 0,\n 0,\n destCanvas.width,\n destCanvas.height,\n );\n }\n\n this.margin = CanvasSaveButton.getMargin(destCanvas);\n\n // Custom info\n let logoPromise = Promise.resolve();\n if (destContext && extraData && extraData.logo) {\n logoPromise = this.drawElement(extraData.logo, destCanvas);\n }\n\n logoPromise.then((logoSize = [0, 0]) => {\n // North arrow\n let arrowPromise = Promise.resolve();\n if (destContext && extraData && extraData.northArrow) {\n arrowPromise = this.drawElement(\n {\n src: extraData.northArrow.circled\n ? NorthArrowCircle\n : NorthArrowSimple,\n ...extraData.northArrow,\n },\n destCanvas,\n logoSize,\n );\n }\n\n // Copyright\n arrowPromise.then((arrowSize = [0, 0]) => {\n const widestElement = Math.max(logoSize[0], arrowSize[0]);\n if (\n destContext &&\n extraData &&\n extraData.copyright &&\n extraData.copyright.text\n ) {\n const maxWidth = widestElement\n ? destContext.canvas.width - widestElement - this.margin\n : destContext.canvas.width;\n this.drawCopyright(destContext, destCanvas, maxWidth);\n }\n let qrCodePromise = Promise.resolve();\n if (destContext && extraData && extraData.qrCode) {\n qrCodePromise = this.drawElement(\n extraData.qrCode,\n destCanvas,\n undefined,\n \"left\",\n );\n }\n qrCodePromise.then(() => {\n return resolve(destCanvas);\n });\n });\n });\n });\n mapToExport.renderSync();\n });\n }\n\n downloadCanvasImage(canvas) {\n // Use blob for large images\n const promise = new Promise((resolve) => {\n const { format } = this.props;\n if (/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())) {\n // ie 9 and 10\n const url = canvas.toDataURL(format);\n const w = window.open(\"about:blank\", \"\");\n w.document.write(`<img src=\"${url}\" alt=\"from canvas\"/>`);\n resolve(url);\n }\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n let image;\n try {\n image = canvas.msToBlob();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n const blob = new Blob([image], {\n type: format,\n });\n resolve(blob);\n window.navigator.msSaveBlob(blob, this.getDownloadImageName());\n } else {\n canvas.toBlob((blob) => {\n const link = document.createElement(\"a\");\n link.download = this.getDownloadImageName();\n link.href = URL.createObjectURL(blob);\n // append child to document for firefox to be able to download.\n document.body.appendChild(link);\n link.click();\n resolve(blob);\n }, format);\n }\n });\n return promise;\n }\n\n render() {\n const { children, ...other } = this.props;\n\n delete other.onSaveStart;\n delete other.onSaveEnd;\n delete other.extraData;\n delete other.extent;\n delete other.format;\n delete other.map;\n delete other.coordinates;\n delete other.autoDownload;\n delete other.scale;\n\n return (\n <div\n role=\"button\"\n className=\"rs-canvas-save-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={(e) => {\n return this.onClick(e);\n }}\n onKeyPress={(e) => {\n return e.which === 13 && this.onClick(e);\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nCanvasSaveButton.propTypes = propTypes;\nCanvasSaveButton.defaultProps = defaultProps;\n\nexport default CanvasSaveButton;\n"],
5
5
  "mappings": "AACA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY,sBAAsB;AAC3C,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAE7B,MAAM,uBAAuB,UAAU,MAAM;AAAA,EAC3C,KAAK,UAAU;AAAA,EACf,OAAO,UAAU;AAAA,EACjB,QAAQ,UAAU;AAAA,EAClB,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,I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W,KAAK,qBAAqB;AAC1C,eAAK,OAAO,IAAI,gBAAgB,IAAI;AAEpC,mBAAS,KAAK,YAAY,IAAI;AAC9B,eAAK,MAAM;AACX,kBAAQ,IAAI;AAAA,QACd,GAAG,MAAM;AAAA,MACX;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,UAAU,GAAG,MAAM,IAAI,KAAK;AAEpC,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AACb,WAAO,MAAM;AAEb,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,WAAU;AAAA,QACV,UAAU;AAAA,QAET,GAAG;AAAA,QACJ,SAAS,CAAC,MAAM;AACd,iBAAO,KAAK,QAAQ,CAAC;AAAA,QACvB;AAAA,QACA,YAAY,CAAC,MAAM;AACjB,iBAAO,EAAE,UAAU,MAAM,KAAK,QAAQ,CAAC;AAAA,QACzC;AAAA;AAAA,MAEC;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,iBAAiB,YAAY;AAC7B,iBAAiB,eAAe;AAEhC,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/CanvasSaveButton/index.js"],
4
- "sourcesContent": ["export { default } from './CanvasSaveButton';\n"],
4
+ "sourcesContent": ["export { default } from \"./CanvasSaveButton\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Copyright/Copyright.js"],
4
- "sourcesContent": ["import React, { useMemo, useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { Map } from 'ol';\nimport { CopyrightControl } from 'mobility-toolbox-js/ol';\n\nconst propTypes = {\n /**\n * A map.\n */\n map: PropTypes.instanceOf(Map).isRequired,\n\n /**\n * Format function. Called with an array of copyrights from visible layers\n * and returns the copyright.\n */\n format: PropTypes.func,\n\n /**\n * CSS class of th root element\n */\n className: PropTypes.string,\n};\n\nconst defaultProps = {\n format: (copyrights) => {\n return copyrights.join(' | ');\n },\n className: 'rs-copyright',\n};\n\n/**\n * The Copyright component uses the\n * [mobility-toolbox-js CopyrightControl](https://mobility-toolbox-js.geops.io/api/class/src/mapbox/controls/CopyrightControl%20js~CopyrightControl%20html-offset-anchor)\n * to render the layer copyrights.\n */\nfunction Copyright({ map, format, ...other }) {\n const [copyrights, setCopyrights] = useState([]);\n\n const control = useMemo(\n () => {\n return new CopyrightControl({\n target: document.createElement('div'),\n element: document.createElement('div'),\n render() {\n // eslint-disable-next-line react/no-this-in-sfc\n const newCopyrights = this.getCopyrights();\n if (copyrights.toString() !== newCopyrights.toString()) {\n setCopyrights(newCopyrights);\n }\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Ensure the control is not associated to the wrong map\n useEffect(() => {\n if (!control) {\n return () => {};\n }\n\n control.map = map;\n\n return () => {\n control.map = null;\n };\n }, [map, control]);\n\n if (!control || !control.getCopyrights().length) {\n return null;\n }\n\n return (\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: format(copyrights) || '',\n }}\n />\n );\n}\n\nCopyright.propTypes = propTypes;\nCopyright.defaultProps = defaultProps;\n\nexport default React.memo(Copyright);\n"],
4
+ "sourcesContent": ["import React, { useMemo, useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Map } from \"ol\";\nimport { CopyrightControl } from \"mobility-toolbox-js/ol\";\n\nconst propTypes = {\n /**\n * A map.\n */\n map: PropTypes.instanceOf(Map).isRequired,\n\n /**\n * Format function. Called with an array of copyrights from visible layers\n * and returns the copyright.\n */\n format: PropTypes.func,\n\n /**\n * CSS class of th root element\n */\n className: PropTypes.string,\n};\n\nconst defaultProps = {\n format: (copyrights) => {\n return copyrights.join(\" | \");\n },\n className: \"rs-copyright\",\n};\n\n/**\n * The Copyright component uses the\n * [mobility-toolbox-js CopyrightControl](https://mobility-toolbox-js.geops.io/api/class/src/mapbox/controls/CopyrightControl%20js~CopyrightControl%20html-offset-anchor)\n * to render the layer copyrights.\n */\nfunction Copyright({ map, format, ...other }) {\n const [copyrights, setCopyrights] = useState([]);\n\n const control = useMemo(\n () => {\n return new CopyrightControl({\n target: document.createElement(\"div\"),\n element: document.createElement(\"div\"),\n render() {\n // eslint-disable-next-line react/no-this-in-sfc\n const newCopyrights = this.getCopyrights();\n if (copyrights.toString() !== newCopyrights.toString()) {\n setCopyrights(newCopyrights);\n }\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Ensure the control is not associated to the wrong map\n useEffect(() => {\n if (!control) {\n return () => {};\n }\n\n control.map = map;\n\n return () => {\n control.map = null;\n };\n }, [map, control]);\n\n if (!control || !control.getCopyrights().length) {\n return null;\n }\n\n return (\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: format(copyrights) || \"\",\n }}\n />\n );\n}\n\nCopyright.propTypes = propTypes;\nCopyright.defaultProps = defaultProps;\n\nexport default React.memo(Copyright);\n"],
5
5
  "mappings": "AAAA,OAAO,SAAS,SAAS,WAAW,gBAAgB;AACpD,OAAO,eAAe;AACtB,SAAS,WAAW;AACpB,SAAS,wBAAwB;AAEjC,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,GAAG,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA,EAKlB,WAAW,UAAU;AACvB;AAEA,MAAM,eAAe;AAAA,EACnB,QAAQ,CAAC,eAAe;AACtB,WAAO,WAAW,KAAK,KAAK;AAAA,EAC9B;AAAA,EACA,WAAW;AACb;AAOA,SAAS,UAAU,EAAE,KAAK,QAAQ,GAAG,MAAM,GAAG;AAC5C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC,CAAC;AAE/C,QAAM,UAAU;AAAA,IACd,MAAM;AACJ,aAAO,IAAI,iBAAiB;AAAA,QAC1B,QAAQ,SAAS,cAAc,KAAK;AAAA,QACpC,SAAS,SAAS,cAAc,KAAK;AAAA,QACrC,SAAS;AAEP,gBAAM,gBAAgB,KAAK,cAAc;AACzC,cAAI,WAAW,SAAS,MAAM,cAAc,SAAS,GAAG;AACtD,0BAAc,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA;AAAA,IAEA,CAAC;AAAA,EACH;AAGA,YAAU,MAAM;AACd,QAAI,CAAC,SAAS;AACZ,aAAO,MAAM;AAAA,MAAC;AAAA,IAChB;AAEA,YAAQ,MAAM;AAEd,WAAO,MAAM;AACX,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC;AAEjB,MAAI,CAAC,WAAW,CAAC,QAAQ,cAAc,EAAE,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MAEE,GAAG;AAAA,MAEJ,yBAAyB;AAAA,QACvB,QAAQ,OAAO,UAAU,KAAK;AAAA,MAChC;AAAA;AAAA,EACF;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe,MAAM,KAAK,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Copyright/index.js"],
4
- "sourcesContent": ["export { default } from './Copyright';\n"],
4
+ "sourcesContent": ["export { default } from \"./Copyright\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FeatureExportButton/FeatureExportButton.js"],
4
- "sourcesContent": ["import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport KMLFormat from 'ol/format/KML';\nimport { Layer } from 'mobility-toolbox-js/ol';\nimport KML from '../../utils/KML';\n\nconst propTypes = {\n /**\n * Children content of the Feature export button.\n */\n children: PropTypes.node,\n\n /**\n * Format to export features (function).\n * Supported formats: https://openlayers.org/en/latest/apidoc/module-ol_format_Feature-FeatureFormat.html\n */\n format: PropTypes.func,\n\n /**\n * An existing [mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers),\n * using a valid [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html)\n */\n layer: PropTypes.instanceOf(Layer).isRequired,\n\n /**\n * Map projection.\n */\n projection: PropTypes.string,\n};\n\nconst defaultProps = {\n children: null,\n format: KMLFormat,\n projection: 'EPSG:3857',\n};\n\n/**\n * The FeatureExportButton component creates a button that exports feature geometries\n * from a [[mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers)]\n * containing an [ol/layer/Vector](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)\n * with a [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html) on click.<br>\n * The default export format is KML, which supports the features' style export.<br>\n * Other formats do not always support style export (See specific format specs).\n */\nclass FeatureExportButton extends PureComponent {\n static createFeatureString(layer, projection, format) {\n if (format === KMLFormat) {\n return KML.writeFeatures(layer, projection);\n }\n\n // eslint-disable-next-line new-cap\n return new format().writeFeatures(layer.olLayer.getSource().getFeatures(), {\n featureProjection: projection,\n });\n }\n\n static exportFeatures(layer, projection, format) {\n const now = new Date()\n .toJSON()\n .slice(0, 20)\n .replace(/[.:T-]+/g, '');\n const featString = this.createFeatureString(layer, projection, format);\n\n const formatString = featString\n ? featString.match(/<(\\w+)\\s+\\w+.*?>/)[1]\n : 'xml';\n\n const fileName = `exported_features_${now}.${formatString}`;\n const charset = document.characterSet || 'UTF-8';\n const type = `${\n formatString === 'kml'\n ? 'data:application/vnd.google-earth.kml+xml'\n : 'data:text/xml'\n };charset=${charset}`;\n\n if (featString) {\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n window.navigator.msSaveBlob(new Blob([featString], { type }), fileName);\n } else {\n const link = document.createElement('a');\n link.download = fileName;\n link.href = `${type},${encodeURIComponent(featString)}`;\n link.click();\n }\n }\n }\n\n render() {\n const { children, layer, projection, format, ...other } = this.props;\n\n return (\n <div\n role=\"button\"\n className=\"rs-feature-export-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={() => {\n return FeatureExportButton.exportFeatures(layer, projection, format);\n }}\n onKeyPress={(evt) => {\n return (\n evt.which === 13 &&\n FeatureExportButton.exportFeatures(layer, projection, format)\n );\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nFeatureExportButton.propTypes = propTypes;\nFeatureExportButton.defaultProps = defaultProps;\n\nexport default FeatureExportButton;\n"],
4
+ "sourcesContent": ["import React, { PureComponent } from \"react\";\nimport PropTypes from \"prop-types\";\nimport KMLFormat from \"ol/format/KML\";\nimport { Layer } from \"mobility-toolbox-js/ol\";\nimport KML from \"../../utils/KML\";\n\nconst propTypes = {\n /**\n * Children content of the Feature export button.\n */\n children: PropTypes.node,\n\n /**\n * Format to export features (function).\n * Supported formats: https://openlayers.org/en/latest/apidoc/module-ol_format_Feature-FeatureFormat.html\n */\n format: PropTypes.func,\n\n /**\n * An existing [mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers),\n * using a valid [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html)\n */\n layer: PropTypes.instanceOf(Layer).isRequired,\n\n /**\n * Map projection.\n */\n projection: PropTypes.string,\n};\n\nconst defaultProps = {\n children: null,\n format: KMLFormat,\n projection: \"EPSG:3857\",\n};\n\n/**\n * The FeatureExportButton component creates a button that exports feature geometries\n * from a [[mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers)]\n * containing an [ol/layer/Vector](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)\n * with a [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html) on click.<br>\n * The default export format is KML, which supports the features' style export.<br>\n * Other formats do not always support style export (See specific format specs).\n */\nclass FeatureExportButton extends PureComponent {\n static createFeatureString(layer, projection, format) {\n if (format === KMLFormat) {\n return KML.writeFeatures(layer, projection);\n }\n\n // eslint-disable-next-line new-cap\n return new format().writeFeatures(layer.olLayer.getSource().getFeatures(), {\n featureProjection: projection,\n });\n }\n\n static exportFeatures(layer, projection, format) {\n const now = new Date()\n .toJSON()\n .slice(0, 20)\n .replace(/[.:T-]+/g, \"\");\n const featString = this.createFeatureString(layer, projection, format);\n\n const formatString = featString\n ? featString.match(/<(\\w+)\\s+\\w+.*?>/)[1]\n : \"xml\";\n\n const fileName = `exported_features_${now}.${formatString}`;\n const charset = document.characterSet || \"UTF-8\";\n const type = `${\n formatString === \"kml\"\n ? \"data:application/vnd.google-earth.kml+xml\"\n : \"data:text/xml\"\n };charset=${charset}`;\n\n if (featString) {\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n window.navigator.msSaveBlob(new Blob([featString], { type }), fileName);\n } else {\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = `${type},${encodeURIComponent(featString)}`;\n link.click();\n }\n }\n }\n\n render() {\n const { children, layer, projection, format, ...other } = this.props;\n\n return (\n <div\n role=\"button\"\n className=\"rs-feature-export-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={() => {\n return FeatureExportButton.exportFeatures(layer, projection, format);\n }}\n onKeyPress={(evt) => {\n return (\n evt.which === 13 &&\n FeatureExportButton.exportFeatures(layer, projection, format)\n );\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nFeatureExportButton.propTypes = propTypes;\nFeatureExportButton.defaultProps = defaultProps;\n\nexport default FeatureExportButton;\n"],
5
5
  "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,SAAS,aAAa;AACtB,OAAO,SAAS;AAEhB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,OAAO,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKnC,YAAY,UAAU;AACxB;AAEA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,YAAY;AACd;AAUA,MAAM,4BAA4B,cAAc;AAAA,EAC9C,OAAO,oBAAoB,OAAO,YAAY,QAAQ;AACpD,QAAI,WAAW,WAAW;AACxB,aAAO,IAAI,cAAc,OAAO,UAAU;AAAA,IAC5C;AAGA,WAAO,IAAI,OAAO,EAAE,cAAc,MAAM,QAAQ,UAAU,EAAE,YAAY,GAAG;AAAA,MACzE,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,eAAe,OAAO,YAAY,QAAQ;AAC/C,UAAM,OAAM,oBAAI,KAAK,GAClB,OAAO,EACP,MAAM,GAAG,EAAE,EACX,QAAQ,YAAY,EAAE;AACzB,UAAM,aAAa,KAAK,oBAAoB,OAAO,YAAY,MAAM;AAErE,UAAM,eAAe,aACjB,WAAW,MAAM,kBAAkB,EAAE,CAAC,IACtC;AAEJ,UAAM,WAAW,qBAAqB,GAAG,IAAI,YAAY;AACzD,UAAM,UAAU,SAAS,gBAAgB;AACzC,UAAM,OAAO,GACX,iBAAiB,QACb,8CACA,eACN,YAAY,OAAO;AAEnB,QAAI,YAAY;AACd,UAAI,OAAO,UAAU,YAAY;AAE/B,eAAO,UAAU,WAAW,IAAI,KAAK,CAAC,UAAU,GAAG,EAAE,KAAK,CAAC,GAAG,QAAQ;AAAA,MACxE,OAAO;AACL,cAAM,OAAO,SAAS,cAAc,GAAG;AACvC,aAAK,WAAW;AAChB,aAAK,OAAO,GAAG,IAAI,IAAI,mBAAmB,UAAU,CAAC;AACrD,aAAK,MAAM;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,UAAU,OAAO,YAAY,QAAQ,GAAG,MAAM,IAAI,KAAK;AAE/D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,WAAU;AAAA,QACV,UAAU;AAAA,QAET,GAAG;AAAA,QACJ,SAAS,MAAM;AACb,iBAAO,oBAAoB,eAAe,OAAO,YAAY,MAAM;AAAA,QACrE;AAAA,QACA,YAAY,CAAC,QAAQ;AACnB,iBACE,IAAI,UAAU,MACd,oBAAoB,eAAe,OAAO,YAAY,MAAM;AAAA,QAEhE;AAAA;AAAA,MAEC;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,oBAAoB,YAAY;AAChC,oBAAoB,eAAe;AAEnC,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FeatureExportButton/index.js"],
4
- "sourcesContent": ["export { default } from './FeatureExportButton';\n"],
4
+ "sourcesContent": ["export { default } from \"./FeatureExportButton\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FitExtent/FitExtent.js"],
4
- "sourcesContent": ["import React from 'react';\nimport PropTypes from 'prop-types';\nimport OLMap from 'ol/Map';\n\nconst propTypes = {\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * The extent to be zoomed.\n */\n extent: PropTypes.arrayOf(PropTypes.number).isRequired,\n\n /**\n * CSS class for the fitExtent button.\n */\n className: PropTypes.string,\n\n /**\n * Button content.\n */\n children: PropTypes.node.isRequired,\n};\n\nconst defaultProps = {\n className: 'rs-fit-extent',\n};\n\n/**\n * The FitExtent component creates a button that updates the current extent of\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction FitExtent({ map, extent, className, children, ...other }) {\n const fit = (evt) => {\n if (evt.which && evt.which !== 13) {\n return;\n }\n map.getView().cancelAnimations();\n map.getView().fit(extent, map.getSize());\n };\n\n return (\n <div\n className={className}\n role=\"button\"\n tabIndex=\"0\"\n onClick={fit}\n onKeyPress={fit}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n {children}\n </div>\n );\n}\n\nFitExtent.propTypes = propTypes;\nFitExtent.defaultProps = defaultProps;\n\nexport default FitExtent;\n"],
4
+ "sourcesContent": ["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport OLMap from \"ol/Map\";\n\nconst propTypes = {\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * The extent to be zoomed.\n */\n extent: PropTypes.arrayOf(PropTypes.number).isRequired,\n\n /**\n * CSS class for the fitExtent button.\n */\n className: PropTypes.string,\n\n /**\n * Button content.\n */\n children: PropTypes.node.isRequired,\n};\n\nconst defaultProps = {\n className: \"rs-fit-extent\",\n};\n\n/**\n * The FitExtent component creates a button that updates the current extent of\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nfunction FitExtent({ map, extent, className, children, ...other }) {\n const fit = (evt) => {\n if (evt.which && evt.which !== 13) {\n return;\n }\n map.getView().cancelAnimations();\n map.getView().fit(extent, map.getSize());\n };\n\n return (\n <div\n className={className}\n role=\"button\"\n tabIndex=\"0\"\n onClick={fit}\n onKeyPress={fit}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n {children}\n </div>\n );\n}\n\nFitExtent.propTypes = propTypes;\nFitExtent.defaultProps = defaultProps;\n\nexport default FitExtent;\n"],
5
5
  "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,WAAW;AAElB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKjC,QAAQ,UAAU,QAAQ,UAAU,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA,EAK5C,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA,EAKrB,UAAU,UAAU,KAAK;AAC3B;AAEA,MAAM,eAAe;AAAA,EACnB,WAAW;AACb;AAMA,SAAS,UAAU,EAAE,KAAK,QAAQ,WAAW,UAAU,GAAG,MAAM,GAAG;AACjE,QAAM,MAAM,CAAC,QAAQ;AACnB,QAAI,IAAI,SAAS,IAAI,UAAU,IAAI;AACjC;AAAA,IACF;AACA,QAAI,QAAQ,EAAE,iBAAiB;AAC/B,QAAI,QAAQ,EAAE,IAAI,QAAQ,IAAI,QAAQ,CAAC;AAAA,EACzC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,UAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MAEX,GAAG;AAAA;AAAA,IAEH;AAAA,EACH;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe;AAEzB,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FitExtent/index.js"],
4
- "sourcesContent": ["export { default } from './FitExtent';\n"],
4
+ "sourcesContent": ["export { default } from \"./FitExtent\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Geolocation/Geolocation.js"],
4
- "sourcesContent": ["import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\n\nimport OLMap from 'ol/Map';\nimport { transform } from 'ol/proj';\nimport Point from 'ol/geom/Point';\nimport Feature from 'ol/Feature';\nimport { unByKey } from 'ol/Observable';\n\nimport Style from 'ol/style/Style';\nimport Circle from 'ol/style/Circle';\nimport Fill from 'ol/style/Fill';\nimport Stroke from 'ol/style/Stroke';\n\nimport VectorLayer from 'ol/layer/Vector';\nimport VectorSource from 'ol/source/Vector';\n\nimport { FaRegDotCircle } from 'react-icons/fa';\n\nconst propTypes = {\n /**\n * CSS class of the button.\n */\n className: PropTypes.string,\n\n /**\n * Children content of the Geolocation button.\n */\n children: PropTypes.node,\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Function triggered when geolocating is not successful.\n */\n onError: PropTypes.func,\n\n /**\n * Function triggered after successful geoLocation calls. Takes the ol/map, the current lat/lon coordinate and the component instance as arguments.\n */\n onSuccess: PropTypes.func,\n\n /**\n * Function triggered after the geolocation is activated. Takes the ol/map and the component instance as arguments.\n */\n onActivate: PropTypes.func,\n\n /**\n * Function triggered after the geolocation is deactivated. Takes the ol/map and the component instance as arguments..\n */\n onDeactivate: PropTypes.func,\n\n /**\n * If true, the map is not centered after it has been dragged once.\n */\n noCenterAfterDrag: PropTypes.bool,\n\n /**\n * If true, the map will constantly recenter to the current Position\n */\n alwaysRecenterToPosition: PropTypes.bool,\n\n /**\n * Color (Number array with rgb values) or style function.\n * If a color is given, the style is animated.\n */\n colorOrStyleFunc: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.number),\n PropTypes.func,\n ]),\n};\n\nconst defaultProps = {\n className: 'rs-geolocation',\n children: <FaRegDotCircle focusable={false} />,\n onError: () => {},\n onSuccess: () => {},\n onActivate: () => {},\n onDeactivate: () => {},\n noCenterAfterDrag: false,\n alwaysRecenterToPosition: true,\n colorOrStyleFunc: [235, 0, 0],\n};\n\n/**\n * The GeoLocation component creates a button to display the current device's location on an\n * [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nclass Geolocation extends PureComponent {\n constructor(props) {\n super(props);\n\n this.layer = new VectorLayer({\n source: new VectorSource(),\n });\n\n this.isRecenteringToPosition = true;\n\n this.state = {\n active: false,\n };\n this.point = undefined;\n }\n\n componentWillUnmount() {\n this.deactivate();\n }\n\n toggle() {\n const { active } = this.state;\n const { onError } = this.props;\n const geolocation = 'geolocation' in navigator;\n\n if (!geolocation) {\n onError();\n } else if (!active) {\n this.activate();\n } else {\n this.deactivate();\n }\n }\n\n error() {\n const { onError } = this.props;\n\n this.deactivate();\n onError();\n }\n\n deactivate() {\n const { map, onDeactivate } = this.props;\n window.clearInterval(this.interval);\n this.layer.setMap(null);\n navigator.geolocation.clearWatch(this.watch);\n\n this.setState({\n active: false,\n });\n\n this.isRecenteringToPosition = true;\n this.point = undefined;\n onDeactivate(map, this);\n unByKey(this.dragListener);\n }\n\n activate() {\n const { map, noCenterAfterDrag, onActivate } = this.props;\n\n this.projection = map.getView().getProjection().getCode();\n this.point = new Point([0, 0]);\n this.highlight();\n this.layer.setMap(map);\n this.setState({ active: true });\n\n this.watch = navigator.geolocation.watchPosition(\n this.update.bind(this),\n this.error.bind(this),\n {\n enableHighAccuracy: true,\n },\n );\n\n if (noCenterAfterDrag) {\n this.dragListener = map.on('pointerdrag', () => {\n this.isRecenteringToPosition = false;\n });\n }\n\n onActivate(map, this);\n }\n\n update({ coords: { latitude, longitude } }) {\n const { map, alwaysRecenterToPosition, onSuccess } = this.props;\n\n const position = transform(\n [longitude, latitude],\n 'EPSG:4326',\n this.projection,\n );\n this.point.setCoordinates(position);\n\n if (this.isRecenteringToPosition) {\n map.getView().setCenter(position);\n if (!alwaysRecenterToPosition) {\n this.isRecenteringToPosition = false;\n }\n }\n\n onSuccess(map, [latitude, longitude], this);\n }\n\n highlight() {\n const { colorOrStyleFunc } = this.props;\n const feature = new Feature({\n geometry: this.point,\n });\n\n if (Array.isArray(colorOrStyleFunc)) {\n const color = colorOrStyleFunc;\n\n let decrease = true;\n let opacity = 0.5;\n let rotation = 0;\n\n window.clearInterval(this.interval);\n this.interval = window.setInterval(() => {\n rotation += 0.03;\n decrease = opacity < 0.1 ? false : decrease;\n decrease = opacity > 0.5 ? true : decrease;\n opacity += decrease ? -0.03 : 0.03;\n if (feature) {\n feature.changed();\n }\n }, 50);\n\n feature.setStyle(() => {\n const circleStyle = new Style({\n image: new Circle({\n radius: 20,\n rotation,\n fill: new Fill({\n color: 'rgba(255, 255, 255, 0.01)',\n }),\n stroke: new Stroke({\n lineDash: [30, 10],\n width: 6,\n color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, ${opacity})`,\n }),\n }),\n });\n\n circleStyle.getImage().setRotation(rotation);\n\n return [\n new Style({\n image: new Circle({\n radius: 10,\n fill: new Fill({\n color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.5)`,\n }),\n }),\n }),\n circleStyle,\n ];\n });\n } else {\n feature.setStyle(colorOrStyleFunc);\n }\n\n this.layer.getSource().clear();\n this.layer.getSource().addFeature(feature);\n }\n\n render() {\n const { children, className } = this.props;\n // Remove component props from other HTML props.\n const other = Object.entries(this.props).reduce((props, [key, value]) => {\n return propTypes[key] ? props : { ...props, [key]: value };\n }, {});\n const { active } = this.state;\n\n return (\n <div\n role=\"button\"\n tabIndex=\"0\"\n className={`${className} ${active ? 'rs-active' : ''}`}\n onClick={() => {\n return this.toggle();\n }}\n onKeyPress={(e) => {\n return e.which === 13 && this.toggle();\n }}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n {children}\n </div>\n );\n }\n}\n\nGeolocation.propTypes = propTypes;\nGeolocation.defaultProps = defaultProps;\n\nexport default Geolocation;\n"],
4
+ "sourcesContent": ["import React, { PureComponent } from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport OLMap from \"ol/Map\";\nimport { transform } from \"ol/proj\";\nimport Point from \"ol/geom/Point\";\nimport Feature from \"ol/Feature\";\nimport { unByKey } from \"ol/Observable\";\n\nimport Style from \"ol/style/Style\";\nimport Circle from \"ol/style/Circle\";\nimport Fill from \"ol/style/Fill\";\nimport Stroke from \"ol/style/Stroke\";\n\nimport VectorLayer from \"ol/layer/Vector\";\nimport VectorSource from \"ol/source/Vector\";\n\nimport { FaRegDotCircle } from \"react-icons/fa\";\n\nconst propTypes = {\n /**\n * CSS class of the button.\n */\n className: PropTypes.string,\n\n /**\n * Children content of the Geolocation button.\n */\n children: PropTypes.node,\n\n /**\n * An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\n map: PropTypes.instanceOf(OLMap).isRequired,\n\n /**\n * Function triggered when geolocating is not successful.\n */\n onError: PropTypes.func,\n\n /**\n * Function triggered after successful geoLocation calls. Takes the ol/map, the current lat/lon coordinate and the component instance as arguments.\n */\n onSuccess: PropTypes.func,\n\n /**\n * Function triggered after the geolocation is activated. Takes the ol/map and the component instance as arguments.\n */\n onActivate: PropTypes.func,\n\n /**\n * Function triggered after the geolocation is deactivated. Takes the ol/map and the component instance as arguments..\n */\n onDeactivate: PropTypes.func,\n\n /**\n * If true, the map is not centered after it has been dragged once.\n */\n noCenterAfterDrag: PropTypes.bool,\n\n /**\n * If true, the map will constantly recenter to the current Position\n */\n alwaysRecenterToPosition: PropTypes.bool,\n\n /**\n * Color (Number array with rgb values) or style function.\n * If a color is given, the style is animated.\n */\n colorOrStyleFunc: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.number),\n PropTypes.func,\n ]),\n};\n\nconst defaultProps = {\n className: \"rs-geolocation\",\n children: <FaRegDotCircle focusable={false} />,\n onError: () => {},\n onSuccess: () => {},\n onActivate: () => {},\n onDeactivate: () => {},\n noCenterAfterDrag: false,\n alwaysRecenterToPosition: true,\n colorOrStyleFunc: [235, 0, 0],\n};\n\n/**\n * The GeoLocation component creates a button to display the current device's location on an\n * [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n */\nclass Geolocation extends PureComponent {\n constructor(props) {\n super(props);\n\n this.layer = new VectorLayer({\n source: new VectorSource(),\n });\n\n this.isRecenteringToPosition = true;\n\n this.state = {\n active: false,\n };\n this.point = undefined;\n }\n\n componentWillUnmount() {\n this.deactivate();\n }\n\n toggle() {\n const { active } = this.state;\n const { onError } = this.props;\n const geolocation = \"geolocation\" in navigator;\n\n if (!geolocation) {\n onError();\n } else if (!active) {\n this.activate();\n } else {\n this.deactivate();\n }\n }\n\n error() {\n const { onError } = this.props;\n\n this.deactivate();\n onError();\n }\n\n deactivate() {\n const { map, onDeactivate } = this.props;\n window.clearInterval(this.interval);\n this.layer.setMap(null);\n navigator.geolocation.clearWatch(this.watch);\n\n this.setState({\n active: false,\n });\n\n this.isRecenteringToPosition = true;\n this.point = undefined;\n onDeactivate(map, this);\n unByKey(this.dragListener);\n }\n\n activate() {\n const { map, noCenterAfterDrag, onActivate } = this.props;\n\n this.projection = map.getView().getProjection().getCode();\n this.point = new Point([0, 0]);\n this.highlight();\n this.layer.setMap(map);\n this.setState({ active: true });\n\n this.watch = navigator.geolocation.watchPosition(\n this.update.bind(this),\n this.error.bind(this),\n {\n enableHighAccuracy: true,\n },\n );\n\n if (noCenterAfterDrag) {\n this.dragListener = map.on(\"pointerdrag\", () => {\n this.isRecenteringToPosition = false;\n });\n }\n\n onActivate(map, this);\n }\n\n update({ coords: { latitude, longitude } }) {\n const { map, alwaysRecenterToPosition, onSuccess } = this.props;\n\n const position = transform(\n [longitude, latitude],\n \"EPSG:4326\",\n this.projection,\n );\n this.point.setCoordinates(position);\n\n if (this.isRecenteringToPosition) {\n map.getView().setCenter(position);\n if (!alwaysRecenterToPosition) {\n this.isRecenteringToPosition = false;\n }\n }\n\n onSuccess(map, [latitude, longitude], this);\n }\n\n highlight() {\n const { colorOrStyleFunc } = this.props;\n const feature = new Feature({\n geometry: this.point,\n });\n\n if (Array.isArray(colorOrStyleFunc)) {\n const color = colorOrStyleFunc;\n\n let decrease = true;\n let opacity = 0.5;\n let rotation = 0;\n\n window.clearInterval(this.interval);\n this.interval = window.setInterval(() => {\n rotation += 0.03;\n decrease = opacity < 0.1 ? false : decrease;\n decrease = opacity > 0.5 ? true : decrease;\n opacity += decrease ? -0.03 : 0.03;\n if (feature) {\n feature.changed();\n }\n }, 50);\n\n feature.setStyle(() => {\n const circleStyle = new Style({\n image: new Circle({\n radius: 20,\n rotation,\n fill: new Fill({\n color: \"rgba(255, 255, 255, 0.01)\",\n }),\n stroke: new Stroke({\n lineDash: [30, 10],\n width: 6,\n color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, ${opacity})`,\n }),\n }),\n });\n\n circleStyle.getImage().setRotation(rotation);\n\n return [\n new Style({\n image: new Circle({\n radius: 10,\n fill: new Fill({\n color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, 0.5)`,\n }),\n }),\n }),\n circleStyle,\n ];\n });\n } else {\n feature.setStyle(colorOrStyleFunc);\n }\n\n this.layer.getSource().clear();\n this.layer.getSource().addFeature(feature);\n }\n\n render() {\n const { children, className } = this.props;\n // Remove component props from other HTML props.\n const other = Object.entries(this.props).reduce((props, [key, value]) => {\n return propTypes[key] ? props : { ...props, [key]: value };\n }, {});\n const { active } = this.state;\n\n return (\n <div\n role=\"button\"\n tabIndex=\"0\"\n className={`${className} ${active ? \"rs-active\" : \"\"}`}\n onClick={() => {\n return this.toggle();\n }}\n onKeyPress={(e) => {\n return e.which === 13 && this.toggle();\n }}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n >\n {children}\n </div>\n );\n }\n}\n\nGeolocation.propTypes = propTypes;\nGeolocation.defaultProps = defaultProps;\n\nexport default Geolocation;\n"],
5
5
  "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AAEtB,OAAO,WAAW;AAClB,SAAS,iBAAi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,YAAY,CAAC,MAAM;AACjB,iBAAO,EAAE,UAAU,MAAM,KAAK,OAAO;AAAA,QACvC;AAAA,QAEC,GAAG;AAAA;AAAA,MAEH;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,YAAY,YAAY;AACxB,YAAY,eAAe;AAE3B,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Geolocation/index.js"],
4
- "sourcesContent": ["export { default } from './Geolocation';\n"],
4
+ "sourcesContent": ["export { default } from \"./Geolocation\";\n"],
5
5
  "mappings": "AAAA,SAAS,eAAe;",
6
6
  "names": []
7
7
  }