File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
1414 watch ,
1515 onMounted ,
1616 onUnmounted ,
17- computed ,
17+ shallowRef ,
1818} from " vue" ;
1919
2020import type Map from " ol/Map" ;
@@ -35,7 +35,7 @@ const htmlContent = ref<HTMLElement>();
3535
3636const { properties } = usePropsAsObjectProperties (props );
3737
38- const overlay = computed (() => new Overlay (properties ));
38+ const overlay = shallowRef ( new Overlay (properties ));
3939
4040useOpenLayersEvents (overlay , [
4141 " change:element" ,
@@ -71,10 +71,18 @@ onMounted(() => {
7171
7272onUnmounted (() => removeOverlay (overlay .value ));
7373
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+ );
7886
7987watchEffect (
8088 () => {
Original file line number Diff line number Diff line change 1818 :position =" [item + 37.9 + offset, 40.1]"
1919 v-for =" item in list"
2020 :key =" item"
21+ :autoPan =" true"
2122 >
2223 <div class =" overlay-content" >
2324 {{ item }}
You can’t perform that action at this time.
0 commit comments