diff --git a/src/components/carte/Carto.vue b/src/components/carte/Carto.vue index bfa909c..3dbc2c7 100644 --- a/src/components/carte/Carto.vue +++ b/src/components/carte/Carto.vue @@ -61,7 +61,8 @@ const mapIsReady = computed(() => { + :control-options="props.selectedControls" + :map-id="mainMap"/> diff --git a/src/components/carte/Map.vue b/src/components/carte/Map.vue index a19732b..e306e97 100644 --- a/src/components/carte/Map.vue +++ b/src/components/carte/Map.vue @@ -29,10 +29,10 @@ const mapRef = ref(null) * Map * default controls are removed (rotate, zoom and attributions) */ -const map = reactive(new Map({ +const map = new Map({ target: props.mapId, controls: [] // on supprime les contrôles par defaut ! - })) + }) provide(props.mapId, map) onMounted(() => { diff --git a/src/components/carte/control/Attributions.vue b/src/components/carte/control/Attributions.vue index 7931c1b..5fd840b 100644 --- a/src/components/carte/control/Attributions.vue +++ b/src/components/carte/control/Attributions.vue @@ -7,13 +7,14 @@ import Attributions from 'ol/control/Attribution' // - tracker Eulerian !? const props = defineProps({ + mapId: String, visibility: Boolean, analytic: Boolean, attributionsOptions: Object }) -import { mainMap } from "@/composables/keys" -const map = inject(mainMap) + +const map = inject(props.mapId) const attributions = ref(new Attributions(props.attributionsOptions)) onMounted(() => { diff --git a/src/components/carte/control/ControlList.vue b/src/components/carte/control/ControlList.vue index 68b4154..ec4b799 100644 --- a/src/components/carte/control/ControlList.vue +++ b/src/components/carte/control/ControlList.vue @@ -5,10 +5,11 @@ import { useLogger } from 'vue-logger-plugin' import { ControlList } from 'geopf-extensions-openlayers' -import { mainMap } from "@/composables/keys" + import { selectedControls } from '@/composables/mapControls' const props = defineProps({ + mapId: String, visibility: Boolean, analytic: Boolean, controlListOptions: Object @@ -16,7 +17,7 @@ const props = defineProps({ const log = useLogger() -const map = inject(mainMap) +const map = inject(props.mapId) const controlList = ref(new ControlList(props.controlListOptions)) const isSmallScreen = useMatchMedia('SM') diff --git a/src/components/carte/control/Drawing.vue b/src/components/carte/control/Drawing.vue index 0a88733..fea93d3 100644 --- a/src/components/carte/control/Drawing.vue +++ b/src/components/carte/control/Drawing.vue @@ -1,15 +1,16 @@ - +