diff --git a/package.json b/package.json index 7e7a6c02d..79c6072ee 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@dhis2/d2-ui-interpretations": "6.2.1", "@dhis2/d2-ui-org-unit-dialog": "5.2.10", "@dhis2/d2-ui-org-unit-tree": "5.2.10", - "@dhis2/gis-api": "^34.0.9", + "@dhis2/gis-api": "^34.0.10", "@dhis2/ui-core": "^4.1.1", "@dhis2/ui-widgets": "^2.0.5", "@material-ui/core": "^3.9.3", diff --git a/src/components/map/Map.js b/src/components/map/Map.js index 11952dd7b..6d8e0c90b 100644 --- a/src/components/map/Map.js +++ b/src/components/map/Map.js @@ -12,6 +12,7 @@ import BoundaryLayer from './BoundaryLayer'; import EarthEngineLayer from './EarthEngineLayer'; import ExternalLayer from './ExternalLayer'; import Popup from './Popup'; +import { controlTypes } from './MapApi'; const layerType = { event: EventLayer, @@ -92,7 +93,9 @@ class Map extends Component { // Add map controls if (controls) { - controls.forEach(control => map.addControl(control)); + controls + .filter(control => controlTypes.includes(control.type)) + .forEach(control => map.addControl(control)); } const layerBounds = map.getLayersBounds(); diff --git a/src/components/map/MapApi.js b/src/components/map/MapApi.js index 18f705aec..79a80f9fc 100644 --- a/src/components/map/MapApi.js +++ b/src/components/map/MapApi.js @@ -1,5 +1,5 @@ -import MapApi, { layerTypes } from '@dhis2/gis-api'; -// import MapApi, { layerTypes } from '@dhis2/maps-gl'; +import MapApi, { layerTypes, controlTypes } from '@dhis2/gis-api'; +// import MapApi, { layerTypes, controlTypes } from '@dhis2/maps-gl'; // Returns a new map instance const map = options => { @@ -9,6 +9,6 @@ const map = options => { return new MapApi(div, options); }; -export { layerTypes }; +export { layerTypes, controlTypes }; export default map; diff --git a/src/constants/mapControls.js b/src/constants/mapControls.js index de80bf6a7..6c59db293 100644 --- a/src/constants/mapControls.js +++ b/src/constants/mapControls.js @@ -3,6 +3,10 @@ export const mapControls = [ type: 'zoom', position: 'top-right', }, + { + type: 'fullscreen', + position: 'top-right', + }, { type: 'fitBounds', position: 'top-right', diff --git a/yarn.lock b/yarn.lock index a993dd863..fc47c24f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -429,10 +429,10 @@ recompose "^0.26.0" rxjs "^5.5.7" -"@dhis2/gis-api@^34.0.9": - version "34.0.9" - resolved "https://registry.yarnpkg.com/@dhis2/gis-api/-/gis-api-34.0.9.tgz#3152cf4161d45b03cdb24758267edb341c5fe4f1" - integrity sha512-KWaNgZmLXgW7sVX0MdngsUszAR6FbswSRTdrdYmfuWofgzvfbfg7uv7tvJCBF4Rbu87hAss/WrpdITuHVksUJA== +"@dhis2/gis-api@^34.0.10": + version "34.0.10" + resolved "https://registry.yarnpkg.com/@dhis2/gis-api/-/gis-api-34.0.10.tgz#9982bda935ecb7280d4323b9ead3b00f33aac65c" + integrity sha512-fODt9My+j7ef0PSHj+IsqpZp3G6j773fG3heMMLKeyIsp1y+I9H7iE0Ds0DHe65eul1dAcrOO6SsbxqzpiGCYw== dependencies: "@google/earthengine" "^0.1.172" "@mapbox/geojson-area" "^0.2.2"