File tree 2 files changed +15
-6
lines changed
2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
14
14
watch ,
15
15
onMounted ,
16
16
onUnmounted ,
17
- computed ,
17
+ shallowRef ,
18
18
} from " vue" ;
19
19
20
20
import type Map from " ol/Map" ;
@@ -35,7 +35,7 @@ const htmlContent = ref<HTMLElement>();
35
35
36
36
const { properties } = usePropsAsObjectProperties (props );
37
37
38
- const overlay = computed (() => new Overlay (properties ));
38
+ const overlay = shallowRef ( new Overlay (properties ));
39
39
40
40
useOpenLayersEvents (overlay , [
41
41
" change:element" ,
@@ -71,10 +71,18 @@ onMounted(() => {
71
71
72
72
onUnmounted (() => removeOverlay (overlay .value ));
73
73
74
- watch (overlay , (newVal , oldVal ) => {
75
- removeOverlay (oldVal );
76
- map ?.addOverlay (newVal );
77
- });
74
+ watch (
75
+ () => properties ,
76
+ (newValue ) => {
77
+ for (const key in newValue ) {
78
+ const keyInObj = key as keyof typeof newValue ;
79
+ if (newValue [keyInObj ]) {
80
+ overlay .value .set (key , newValue [keyInObj ]);
81
+ }
82
+ }
83
+ },
84
+ { deep: true },
85
+ );
78
86
79
87
watchEffect (
80
88
() => {
Original file line number Diff line number Diff line change 18
18
:position =" [item + 37.9 + offset, 40.1]"
19
19
v-for =" item in list"
20
20
:key =" item"
21
+ :autoPan =" true"
21
22
>
22
23
<div class =" overlay-content" >
23
24
{{ item }}
You can’t perform that action at this time.
0 commit comments