Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions samples/3d-accessibility-features/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html>
<!--
@license
Copyright 2025 Google LLC. All Rights Reserved.
Copyright 2026 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_3d_accessibility_features] -->
Expand All @@ -19,7 +19,13 @@
</script>
</head>
<body>
<div id="map"></div>
<gmp-map-3d
center="34.8405,-111.7909"
range="13279.5"
tilt="67.44"
heading="0.01"
mode="satellite"
gesture-handling="cooperative"></gmp-map-3d>
</body>
</html>
<!-- [END maps_3d_accessibility_features] -->
38 changes: 15 additions & 23 deletions samples/3d-accessibility-features/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_3d_accessibility_features]
async function init() {
const [
{ Map3DElement, Marker3DInteractiveElement, PopoverElement },
{ PinElement },
] = await Promise.all([
google.maps.importLibrary('maps3d'),
google.maps.importLibrary('marker'),
]);
async function init(): Promise<void> {
// Import the needed libraries.
const [{ Marker3DInteractiveElement, PopoverElement }, { PinElement }] =
await Promise.all([
google.maps.importLibrary('maps3d'),
google.maps.importLibrary('marker'),
]);

const map = new Map3DElement({
center: { lat: 34.8405, lng: -111.7909, altitude: 1322.7 },
range: 13279.5,
tilt: 67.44,
heading: 0.01,
mode: 'SATELLITE',
gestureHandling: 'COOPERATIVE',
});
const map3DElement = document.querySelector('gmp-map-3d')!;

// 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
Expand Down Expand Up @@ -51,16 +43,16 @@ async function init() {

tourStops.forEach(({ position, title }, i) => {
const pin = new PinElement({
glyphText: `${i + 1}`,
glyphText: String(i + 1),
scale: 1.5,
glyphColor: '#FFFFFF',
});
const popover = new PopoverElement();

const content = `${i + 1}. ${title}`;
const content = `${String(i + 1)}. ${title}`;
const header = document.createElement('span');
// Include the label for screen readers.
header.ariaLabel = `This is marker ${i + 1}. ${title}`;
header.ariaLabel = `This is marker ${String(i + 1)}. ${title}`;
header.slot = 'header';

popover.append(header);
Expand All @@ -75,11 +67,11 @@ async function init() {

interactiveMarker.append(pin);

map.append(interactiveMarker);
map.append(popover);
map3DElement.append(interactiveMarker);
map3DElement.append(popover);
});

document.body.append(map);
document.body.append(map3DElement);
}

void init();
Expand Down
4 changes: 1 addition & 3 deletions samples/3d-accessibility-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
"build:vite": "vite build --base './'",
"preview": "vite preview"
},
"dependencies": {

}
"dependencies": {}
}
2 changes: 1 addition & 1 deletion samples/3d-accessibility-features/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_3d_accessibility_features] */
Expand Down
Loading