File tree Expand file tree Collapse file tree 7 files changed +32
-10
lines changed
dist/samples/ui-kit-place-search-text Expand file tree Collapse file tree 7 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,12 @@ async function addMarkers(){
84
84
85
85
const bounds = new LatLngBounds ( ) ;
86
86
87
+ // First remove all existing markers.
88
+ for ( marker in markers ) {
89
+ markers [ marker ] . map = null ;
90
+ }
91
+ markers = { } ;
92
+
87
93
if ( placeList . places . length > 0 ) {
88
94
placeList . places . forEach ( ( place ) => {
89
95
let marker = new AdvancedMarkerElement ( {
@@ -125,4 +131,4 @@ async function addMarkers(){
125
131
/* [END maps_ui_kit_place_search_text_add_markers] */
126
132
127
133
initMap ( ) ;
128
- /* [END maps_ui_kit_place_search_text] */
134
+ /* [END maps_ui_kit_place_search_text] */
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
< head >
10
10
< title > Place List Text Search with Google Maps</ title >
11
11
< meta charset ="utf-8 ">
12
- < script type ="module " crossorigin src ="./assets/index-BwAaQEy9 .js "> </ script >
12
+ < script type ="module " crossorigin src ="./assets/index-D3grIZH1 .js "> </ script >
13
13
< link rel ="stylesheet " crossorigin href ="./assets/index-aU3Z-fv6.css ">
14
14
</ head >
15
15
< body >
Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ async function addMarkers() {
69
69
const { AdvancedMarkerElement } = await google . maps . importLibrary ( "marker" ) ;
70
70
const { LatLngBounds } = await google . maps . importLibrary ( "core" ) ;
71
71
const bounds = new LatLngBounds ( ) ;
72
+ // First remove all existing markers.
73
+ for ( marker in markers ) {
74
+ markers [ marker ] . map = null ;
75
+ }
76
+ markers = { } ;
72
77
if ( placeList . places . length > 0 ) {
73
78
placeList . places . forEach ( ( place ) => {
74
79
let marker = new AdvancedMarkerElement ( {
@@ -106,4 +111,4 @@ async function addMarkers() {
106
111
}
107
112
/* [END maps_ui_kit_place_search_text_add_markers] */
108
113
initMap ( ) ;
109
- /* [END maps_ui_kit_place_search_text] */
114
+ /* [END maps_ui_kit_place_search_text] */
Original file line number Diff line number Diff line change @@ -84,6 +84,12 @@ async function addMarkers(){
84
84
85
85
const bounds = new LatLngBounds ( ) ;
86
86
87
+ // First remove all existing markers.
88
+ for ( marker in markers ) {
89
+ markers [ marker ] . map = null ;
90
+ }
91
+ markers = { } ;
92
+
87
93
if ( placeList . places . length > 0 ) {
88
94
placeList . places . forEach ( ( place ) => {
89
95
let marker = new AdvancedMarkerElement ( {
@@ -125,4 +131,4 @@ async function addMarkers(){
125
131
/* [END maps_ui_kit_place_search_text_add_markers] */
126
132
127
133
initMap ( ) ;
128
- /* [END maps_ui_kit_place_search_text] */
134
+ /* [END maps_ui_kit_place_search_text] */
Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ async function addMarkers() {
69
69
const { AdvancedMarkerElement } = await google . maps . importLibrary ( "marker" ) ;
70
70
const { LatLngBounds } = await google . maps . importLibrary ( "core" ) ;
71
71
const bounds = new LatLngBounds ( ) ;
72
+ // First remove all existing markers.
73
+ for ( marker in markers ) {
74
+ markers [ marker ] . map = null ;
75
+ }
76
+ markers = { } ;
72
77
if ( placeList . places . length > 0 ) {
73
78
placeList . places . forEach ( ( place ) => {
74
79
let marker = new AdvancedMarkerElement ( {
@@ -106,4 +111,4 @@ async function addMarkers() {
106
111
}
107
112
/* [END maps_ui_kit_place_search_text_add_markers] */
108
113
initMap ( ) ;
109
- /* [END maps_ui_kit_place_search_text] */
114
+ /* [END maps_ui_kit_place_search_text] */
You can’t perform that action at this time.
0 commit comments