diff --git a/samples/advanced-markers-accessibility/index.html b/samples/advanced-markers-accessibility/index.html index 1eb28a32..0489d6fe 100644 --- a/samples/advanced-markers-accessibility/index.html +++ b/samples/advanced-markers-accessibility/index.html @@ -11,13 +11,13 @@ - - -
+ ({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"}); + + + diff --git a/samples/advanced-markers-accessibility/index.ts b/samples/advanced-markers-accessibility/index.ts index c716075f..f97eebc1 100644 --- a/samples/advanced-markers-accessibility/index.ts +++ b/samples/advanced-markers-accessibility/index.ts @@ -5,17 +5,13 @@ */ // [START maps_advanced_markers_accessibility] +const mapElement = document.querySelector('gmp-map') as google.maps.MapElement; + async function initMap() { // Request needed libraries. const { Map, InfoWindow } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary; const { AdvancedMarkerElement, PinElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary; - const map = new Map(document.getElementById("map") as HTMLElement, { - zoom: 12, - center: { lat: 34.84555, lng: -111.8035 }, - mapId: '4504f8b37365c3d0', - }); - // Set LatLng and title text for the markers. The first marker (Boynton Pass) // receives the initial focus when tab is pressed. Use arrow keys to move // between markers; press tab again to cycle through the map controls. @@ -47,19 +43,19 @@ async function initMap() { // Create the markers. tourStops.forEach(({position, title}, i) => { + // [START maps_advanced_markers_accessibility_marker] const pin = new PinElement({ //@ts-ignore glyphText: `${i + 1}`, scale: 1.5, }); - // [START maps_advanced_markers_accessibility_marker] const marker = new AdvancedMarkerElement({ position, - map, title: `${i + 1}. ${title}`, - content: pin.element, gmpClickable: true, }); + marker.append(pin); + mapElement.append(marker); // [END maps_advanced_markers_accessibility_marker] // [START maps_advanced_markers_accessibility_event_listener] // Add a click listener for each marker, and set up the info window. @@ -74,4 +70,4 @@ async function initMap() { } initMap(); -// [END maps_advanced_markers_accessibility] \ No newline at end of file +// [END maps_advanced_markers_accessibility]