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(){
8484
8585 const bounds = new LatLngBounds ( ) ;
8686
87+ // First remove all existing markers.
88+ for ( marker in markers ) {
89+ markers [ marker ] . map = null ;
90+ }
91+ markers = { } ;
92+
8793 if ( placeList . places . length > 0 ) {
8894 placeList . places . forEach ( ( place ) => {
8995 let marker = new AdvancedMarkerElement ( {
@@ -125,4 +131,4 @@ async function addMarkers(){
125131/* [END maps_ui_kit_place_search_text_add_markers] */
126132
127133initMap ( ) ;
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 99 < head >
1010 < title > Place List Text Search with Google Maps</ title >
1111 < 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 >
1313 < link rel ="stylesheet " crossorigin href ="./assets/index-aU3Z-fv6.css ">
1414 </ head >
1515 < body >
Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ async function addMarkers() {
6969 const { AdvancedMarkerElement } = await google . maps . importLibrary ( "marker" ) ;
7070 const { LatLngBounds } = await google . maps . importLibrary ( "core" ) ;
7171 const bounds = new LatLngBounds ( ) ;
72+ // First remove all existing markers.
73+ for ( marker in markers ) {
74+ markers [ marker ] . map = null ;
75+ }
76+ markers = { } ;
7277 if ( placeList . places . length > 0 ) {
7378 placeList . places . forEach ( ( place ) => {
7479 let marker = new AdvancedMarkerElement ( {
@@ -106,4 +111,4 @@ async function addMarkers() {
106111}
107112/* [END maps_ui_kit_place_search_text_add_markers] */
108113initMap ( ) ;
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(){
8484
8585 const bounds = new LatLngBounds ( ) ;
8686
87+ // First remove all existing markers.
88+ for ( marker in markers ) {
89+ markers [ marker ] . map = null ;
90+ }
91+ markers = { } ;
92+
8793 if ( placeList . places . length > 0 ) {
8894 placeList . places . forEach ( ( place ) => {
8995 let marker = new AdvancedMarkerElement ( {
@@ -125,4 +131,4 @@ async function addMarkers(){
125131/* [END maps_ui_kit_place_search_text_add_markers] */
126132
127133initMap ( ) ;
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() {
6969 const { AdvancedMarkerElement } = await google . maps . importLibrary ( "marker" ) ;
7070 const { LatLngBounds } = await google . maps . importLibrary ( "core" ) ;
7171 const bounds = new LatLngBounds ( ) ;
72+ // First remove all existing markers.
73+ for ( marker in markers ) {
74+ markers [ marker ] . map = null ;
75+ }
76+ markers = { } ;
7277 if ( placeList . places . length > 0 ) {
7378 placeList . places . forEach ( ( place ) => {
7479 let marker = new AdvancedMarkerElement ( {
@@ -106,4 +111,4 @@ async function addMarkers() {
106111}
107112/* [END maps_ui_kit_place_search_text_add_markers] */
108113initMap ( ) ;
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