11<script setup>
2- import { computed } from ' vue'
2+ import log from ' @geoadmin/log'
3+ import { computed , ref , watch } from ' vue'
34import { useStore } from ' vuex'
45
6+ import { sendMapReadyEventToParent } from ' @/api/iframePostMessageEvent.api'
57import LayerDescription from ' @/modules/menu/components/LayerDescription.vue'
68import usePrintViewCommons from ' @/views/usePrintViewCommons.composable'
79
810const { printLayout , printContainerStyle } = usePrintViewCommons ()
911
12+ const loadedLayerDescriptions = ref (0 )
13+
1014const store = useStore ()
1115const visibleLayers = computed (() => store .getters .visibleLayers )
16+ const visibleLayersCount = computed (() => visibleLayers .value .length )
17+
18+ watch (visibleLayersCount, () => {
19+ loadedLayerDescriptions .value = 0
20+ })
21+ watch (loadedLayerDescriptions, () => {
22+ if (loadedLayerDescriptions .value === visibleLayersCount .value ) {
23+ log .debug (' All layer descriptions loaded. Sending map ready event to parent window.' )
24+ sendMapReadyEventToParent ()
25+ }
26+ })
1227 </script >
1328
1429<template >
@@ -23,6 +38,7 @@ const visibleLayers = computed(() => store.getters.visibleLayers)
2338 :layer =" layer"
2439 :layer-id =" layer.id"
2540 transform-url-into-qrcode
41+ @loaded =" loadedLayerDescriptions++"
2642 />
2743 </div >
2844</template >
@@ -31,7 +47,7 @@ const visibleLayers = computed(() => store.getters.visibleLayers)
3147.print-legend-view {
3248 display : grid ;
3349 gap : 20px ;
34- grid-template-columns : repeat (3 , 1fr );
50+ grid-template-columns : repeat (2 , 1fr );
3551}
3652
3753@media print {
0 commit comments