@rural-environmental-registry/map_component 2.0.5 → 2.0.6
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.
- package/dist/index.mjs +5946 -5936
- package/package.json +1 -1
- package/src/components/MapDPG.vue +2 -2
- package/src/components/menu/LayerMenu.vue +21 -15
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
<script lang="ts" setup>
|
|
48
48
|
import L from 'leaflet'
|
|
49
|
-
import { computed, ref } from 'vue'
|
|
49
|
+
import { computed, ref, shallowRef } from 'vue'
|
|
50
50
|
import {
|
|
51
51
|
DrawingEvent,
|
|
52
52
|
GroupActionConfig,
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
toggleMeasureArea: () => void
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
const mapRef =
|
|
136
|
+
const mapRef = shallowRef<MapRef>()
|
|
137
137
|
const mapContainerRef = ref<HTMLElement | null>(null)
|
|
138
138
|
const coordinatePanelRef = ref()
|
|
139
139
|
const isLoading = ref<boolean>(false)
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<script lang="ts" setup>
|
|
37
37
|
import { ElButton, ElMenu } from 'element-plus'
|
|
38
38
|
import L from 'leaflet'
|
|
39
|
-
import { computed, nextTick, ref, watch } from 'vue'
|
|
39
|
+
import { computed, markRaw, nextTick, ref, shallowRef, toRaw, watch } from 'vue'
|
|
40
40
|
import FontAwesomeIcon from '../fa-icon/FontAwesomeIcon.vue'
|
|
41
41
|
import SectionMenu from './SectionMenu.vue'
|
|
42
42
|
import {
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
const props = defineProps<MenuProps>()
|
|
90
90
|
|
|
91
91
|
const isMenuOpen = ref<boolean>(!!props.options?.defaultOpen)
|
|
92
|
-
const convertedLayers =
|
|
93
|
-
const convertedGeoJsonLayers =
|
|
92
|
+
const convertedLayers = shallowRef<ConvertedLayers>({})
|
|
93
|
+
const convertedGeoJsonLayers = shallowRef<ConvertedGeoJsonLayers>({})
|
|
94
94
|
const internalEditingLayerKey = ref<string | null>(null)
|
|
95
95
|
const internalSelectedSectionKey = ref<string | null>(null)
|
|
96
96
|
|
|
@@ -389,13 +389,15 @@
|
|
|
389
389
|
|
|
390
390
|
if (!layer.active) return
|
|
391
391
|
|
|
392
|
-
const wmsLayer = convertToWmsLayer(layer)
|
|
392
|
+
const wmsLayer = markRaw(convertToWmsLayer(layer))
|
|
393
393
|
convertedLayers.value[layer.key] = wmsLayer
|
|
394
394
|
|
|
395
|
-
|
|
395
|
+
const rawMap = toRaw(props.map)
|
|
396
|
+
wmsLayer.addTo(rawMap)
|
|
396
397
|
|
|
397
|
-
|
|
398
|
-
|
|
398
|
+
const rawLayerControl = props.layerControl ? toRaw(props.layerControl) : null
|
|
399
|
+
if (rawLayerControl) {
|
|
400
|
+
rawLayerControl.addOverlay(wmsLayer, `${wmsLayer.options.attribution}`)
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
403
|
|
|
@@ -403,8 +405,9 @@
|
|
|
403
405
|
const wmsLayer = convertedLayers.value[layer.key]
|
|
404
406
|
if (!wmsLayer) return
|
|
405
407
|
|
|
406
|
-
props.map
|
|
407
|
-
|
|
408
|
+
const rawMap = toRaw(props.map)
|
|
409
|
+
rawMap.removeLayer(wmsLayer)
|
|
410
|
+
toRaw(props.layerControl)?.removeLayer(wmsLayer)
|
|
408
411
|
|
|
409
412
|
delete convertedLayers.value[layer.key]
|
|
410
413
|
}
|
|
@@ -443,13 +446,15 @@
|
|
|
443
446
|
|
|
444
447
|
if (!layer.active) return
|
|
445
448
|
|
|
446
|
-
const geoJsonLayer = convertToGeojsonLayer(layer)
|
|
449
|
+
const geoJsonLayer = markRaw(convertToGeojsonLayer(layer))
|
|
447
450
|
convertedGeoJsonLayers.value[layer.key] = geoJsonLayer
|
|
448
451
|
|
|
449
|
-
|
|
452
|
+
const rawMap = toRaw(props.map)
|
|
453
|
+
geoJsonLayer.addTo(rawMap)
|
|
450
454
|
|
|
451
|
-
|
|
452
|
-
|
|
455
|
+
const rawLayerControl = props.layerControl ? toRaw(props.layerControl) : null
|
|
456
|
+
if (rawLayerControl) {
|
|
457
|
+
rawLayerControl.addOverlay(geoJsonLayer, `${geoJsonLayer.options.attribution}`)
|
|
453
458
|
}
|
|
454
459
|
}
|
|
455
460
|
|
|
@@ -457,8 +462,9 @@
|
|
|
457
462
|
const geoJsonLayer = convertedGeoJsonLayers.value[layer.key]
|
|
458
463
|
if (!geoJsonLayer) return
|
|
459
464
|
|
|
460
|
-
props.map
|
|
461
|
-
|
|
465
|
+
const rawMap = toRaw(props.map)
|
|
466
|
+
rawMap.removeLayer(geoJsonLayer)
|
|
467
|
+
toRaw(props.layerControl)?.removeLayer(geoJsonLayer)
|
|
462
468
|
|
|
463
469
|
delete convertedGeoJsonLayers.value[layer.key]
|
|
464
470
|
}
|