Skip to content

Commit

Permalink
[POC] print vectortiles : only one event triggered for all map renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
pakb committed Jan 21, 2025
1 parent efe4062 commit 1870886
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 9 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/modules/map/components/openlayers/OpenLayersMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { get as getProjection } from 'ol/proj'
import { computed, onMounted, provide, ref } from 'vue'
import { useStore } from 'vuex'
import { sendMapReadyEventToParent } from '@/api/iframeFeatureEvent.api'
import { IS_TESTING_WITH_CYPRESS } from '@/config/staging.config'
import { useLayerZIndexCalculation } from '@/modules/map/components/common/z-index.composable'
import OpenLayersLayerExtents from '@/modules/map/components/openlayers/debug/OpenLayersLayerExtents.vue'
Expand Down Expand Up @@ -57,7 +56,6 @@ map.once('rendercomplete', () => {
store.dispatch('mapModuleReady', dispatcher)
log.info('Openlayer map rendered')
})
map.once('loadend', sendMapReadyEventToParent)
onMounted(() => {
map.setTarget(mapElement.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Source } from 'ol/source'
import { computed, inject, toRefs, watch } from 'vue'
import { useStore } from 'vuex'
import { sendMapReadyEventToParent } from '@/api/iframeFeatureEvent.api'
import GeoAdminVectorLayer from '@/api/layers/GeoAdminVectorLayer.class'
import MapLibreLayer from '@/modules/map/components/openlayers/utils/ol-maplibre-layer/MapLibreLayer'
import useAddLayerToMap from '@/modules/map/components/openlayers/utils/useAddLayerToMap.composable'
Expand Down Expand Up @@ -60,8 +59,6 @@ const layer = new MapLibreLayer({
return zoom
},
})
// for vector tile print POC, we provide another map ready event here
layer.once('load', sendMapReadyEventToParent)
const olMap = inject('olMap')
useAddLayerToMap(layer, olMap, zIndex)
Expand Down
4 changes: 2 additions & 2 deletions src/modules/menu/components/share/MenuShareEmbed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
import { useStore } from 'vuex'
import { IFRAME_EVENTS } from '@/api/iframeFeatureEvent.api'
import { IFRAME_EVENTS } from '@/api/iframePostMessageEvent.api'
import MenuShareInputCopyButton from '@/modules/menu/components/share/MenuShareInputCopyButton.vue'
import ModalWithBackdrop from '@/utils/components/ModalWithBackdrop.vue'
import { useTippyTooltip } from '@/utils/composables/useTippyTooltip'
Expand Down Expand Up @@ -133,7 +133,7 @@ function togglePreviewModal() {
function onPreviewChange(e) {
if (e?.data?.type === IFRAME_EVENTS.CHANGE) {
// see iframeFeatureEvent.api.js -> sendChangeEventToParent
// see iframePostMessageEvent.api.js -> sendChangeEventToParent
embedSource.value = e.data.payload.newUrl
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/features.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toRaw } from 'vue'
import EditableFeature, { EditableFeatureTypes } from '@/api/features/EditableFeature.class'
import getFeature, { identify, identifyOnGeomAdminLayer } from '@/api/features/features.api'
import LayerFeature from '@/api/features/LayerFeature.class'
import { sendFeatureInformationToIFrameParent } from '@/api/iframeFeatureEvent.api'
import { sendFeatureInformationToIFrameParent } from '@/api/iframePostMessageEvent.api'
import getProfile from '@/api/profile/profile.api'
import {
DEFAULT_FEATURE_COUNT_RECTANGLE_SELECTION,
Expand Down
2 changes: 2 additions & 0 deletions src/store/plugins/app-readiness.plugin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sendMapReadyEventToParent } from '@/api/iframePostMessageEvent.api'
import { ENVIRONMENT } from '@/config/staging.config'
import log from '@/utils/logging'

Expand Down Expand Up @@ -38,6 +39,7 @@ const appReadinessPlugin = (store) => {

if (mutation.type === 'mapModuleReady') {
store.dispatch('clearLoadingBar4MapLoading', { dispatcher })
sendMapReadyEventToParent()
}

// In production build we are not interested anymore in the mutation logs
Expand Down
2 changes: 1 addition & 1 deletion src/views/EmbedView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed, onBeforeMount, onMounted, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useStore } from 'vuex'
import { sendChangeEventToParent } from '@/api/iframeFeatureEvent.api'
import { sendChangeEventToParent } from '@/api/iframePostMessageEvent.api'
import I18nModule from '@/modules/i18n/I18nModule.vue'
import InfoboxModule from '@/modules/infobox/InfoboxModule.vue'
import MapFooter from '@/modules/map/components/footer/MapFooter.vue'
Expand Down

0 comments on commit 1870886

Please sign in to comment.