diff --git a/samples/.prettierrc.json b/samples/.prettierrc.json new file mode 100644 index 00000000..e46bc736 --- /dev/null +++ b/samples/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "indentSize": 4, + "trailingComma": "es5", + "tabWidth": 4, + "semi": false, + "singleQuote": true +} \ No newline at end of file diff --git a/samples/3d-accessibility-features/index.html b/samples/3d-accessibility-features/index.html index 8e365885..a7e3a58f 100644 --- a/samples/3d-accessibility-features/index.html +++ b/samples/3d-accessibility-features/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-accessibility-features/index.ts b/samples/3d-accessibility-features/index.ts index 25a7d053..4edd8723 100644 --- a/samples/3d-accessibility-features/index.ts +++ b/samples/3d-accessibility-features/index.ts @@ -1,78 +1,82 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_accessibility_features] async function initMap() { - const { Map3DElement, Marker3DInteractiveElement, PopoverElement } = await google.maps.importLibrary("maps3d"); - const { PinElement } = await google.maps.importLibrary("marker"); + const { Map3DElement, Marker3DInteractiveElement, PopoverElement } = + await google.maps.importLibrary('maps3d') + const { PinElement } = await google.maps.importLibrary('marker') - const map = new Map3DElement({ - center: { lat: 34.8405, lng : -111.7909, altitude: 1322.70 }, range: 13279.50, tilt: 67.44 ,heading: 0.01, - mode: 'SATELLITE' - }); + 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', + }) - // 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. - const tourStops = [ - { - position: { lat: 34.8791806, lng: -111.8265049 }, - title: "Boynton Pass", - }, - { - position: { lat: 34.8559195, lng: -111.7988186 }, - title: "Airport Mesa", - }, - { - position: { lat: 34.832149, lng: -111.7695277 }, - title: "Chapel of the Holy Cross", - }, - { - position: { lat: 34.823736, lng: -111.8001857 }, - title: "Red Rock Crossing", - }, - { - position: { lat: 34.800326, lng: -111.7665047 }, - title: "Bell Rock", - }, - ]; + // 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. + const tourStops = [ + { + position: { lat: 34.8791806, lng: -111.8265049 }, + title: 'Boynton Pass', + }, + { + position: { lat: 34.8559195, lng: -111.7988186 }, + title: 'Airport Mesa', + }, + { + position: { lat: 34.832149, lng: -111.7695277 }, + title: 'Chapel of the Holy Cross', + }, + { + position: { lat: 34.823736, lng: -111.8001857 }, + title: 'Red Rock Crossing', + }, + { + position: { lat: 34.800326, lng: -111.7665047 }, + title: 'Bell Rock', + }, + ] - tourStops.forEach(({ position, title }, i) => { - const pin = new PinElement({ - glyph: `${i + 1}`, - scale: 1.5, - glyphColor: "#FFFFFF" - }); - const popover = new PopoverElement(); + tourStops.forEach(({ position, title }, i) => { + const pin = new PinElement({ + glyph: `${i + 1}`, + scale: 1.5, + glyphColor: '#FFFFFF', + }) + const popover = new PopoverElement() - const content = `${i + 1}. ${title}`; - const header = document.createElement('span'); - // Include the label for screen readers. - header.ariaLabel = `This is marker ${i + 1}. ${title}`; - header.slot = 'header'; + const content = `${i + 1}. ${title}` + const header = document.createElement('span') + // Include the label for screen readers. + header.ariaLabel = `This is marker ${i + 1}. ${title}` + header.slot = 'header' - popover.append(header); - popover.append(content); + popover.append(header) + popover.append(content) - const interactiveMarker = new Marker3DInteractiveElement({ - // Include a title, used for accessibility text for use by screen readers. - title, - position, - gmpPopoverTargetElement: popover - }); + const interactiveMarker = new Marker3DInteractiveElement({ + // Include a title, used for accessibility text for use by screen readers. + title, + position, + gmpPopoverTargetElement: popover, + }) - interactiveMarker.append(pin); + interactiveMarker.append(pin) - map.append(interactiveMarker); - map.append(popover); - }); + map.append(interactiveMarker) + map.append(popover) + }) - document.body.append(map); + document.body.append(map) } -initMap(); +initMap() // [END maps_3d_accessibility_features] diff --git a/samples/3d-accessibility-features/style.css b/samples/3d-accessibility-features/style.css index c4adcecb..f3967a21 100644 --- a/samples/3d-accessibility-features/style.css +++ b/samples/3d-accessibility-features/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_accessibility_features] */ diff --git a/samples/3d-camera-boundary/index.html b/samples/3d-camera-boundary/index.html index ea1e8e78..50e7e413 100644 --- a/samples/3d-camera-boundary/index.html +++ b/samples/3d-camera-boundary/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-camera-boundary/index.ts b/samples/3d-camera-boundary/index.ts index 55882f72..f04209a9 100644 --- a/samples/3d-camera-boundary/index.ts +++ b/samples/3d-camera-boundary/index.ts @@ -1,23 +1,23 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_camera_boundary] async function initMap() { - const { Map3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement } = await google.maps.importLibrary('maps3d') const map = new Map3DElement({ center: { lat: -36.86, lng: 174.76, altitude: 10000 }, tilt: 67.5, mode: 'HYBRID', - bounds: {south: -48.30, west: 163.56, north: -32.86, east: -180}, - }); + bounds: { south: -48.3, west: 163.56, north: -32.86, east: -180 }, + }) - document.body.append(map); + document.body.append(map) } -initMap(); +initMap() // [END maps_3d_camera_boundary] diff --git a/samples/3d-camera-boundary/style.css b/samples/3d-camera-boundary/style.css index 33d3c467..ef386783 100644 --- a/samples/3d-camera-boundary/style.css +++ b/samples/3d-camera-boundary/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_camera_boundary] */ diff --git a/samples/3d-camera-to-around/index.html b/samples/3d-camera-to-around/index.html index 48c551e0..de3880b6 100644 --- a/samples/3d-camera-to-around/index.html +++ b/samples/3d-camera-to-around/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-camera-to-around/index.ts b/samples/3d-camera-to-around/index.ts index 1f1c610c..f250149d 100644 --- a/samples/3d-camera-to-around/index.ts +++ b/samples/3d-camera-to-around/index.ts @@ -1,27 +1,40 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_camera_to_around] async function init() { - const { Map3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement } = await google.maps.importLibrary('maps3d') - const map = new Map3DElement( - { center: { lat: 37.79810773998413, lng : -122.41784275049939, altitude: 89.08476932205978 }, range: 6062.016931506805, tilt: 81.17100663963272, heading: -56.047035719765596, } - ); + const map = new Map3DElement({ + center: { + lat: 37.79810773998413, + lng: -122.41784275049939, + altitude: 89.08476932205978, + }, + range: 6062.016931506805, + tilt: 81.17100663963272, + heading: -56.047035719765596, + }) - map.mode = "SATELLITE"; + map.mode = 'SATELLITE' - document.body.append(map); + document.body.append(map) // Used for both the fly to function and the location to fly around. - const flyToCamera = { - center: { lat: 21.263523536467105, lng : -157.80663691939296, altitude: 80.28936069489404 }, - range: 1500.8202963253427, tilt: 76.9173260789542 ,heading: -44.59196007522445, - }; + const flyToCamera = { + center: { + lat: 21.263523536467105, + lng: -157.80663691939296, + altitude: 80.28936069489404, + }, + range: 1500.8202963253427, + tilt: 76.9173260789542, + heading: -44.59196007522445, + } // Fly the camera from San Francisco to Hawaii, can be controlled by a button alternatively. map.flyCameraTo({ @@ -29,25 +42,29 @@ async function init() { endCamera: flyToCamera, // How long we want the flight to take. durationMillis: 30000, - }); + }) // When the animation has completed, fly around the location. - map.addEventListener('gmp-animationend', () => { - map.flyCameraAround({ - // Location to fly around. - camera: flyToCamera, - // Length of time to fly to the location. - durationMillis: 50000, - // Number of rotations to make in the specified time. - repeatCount: 1 - }); - }, {once: true}); // Stop animation after flying around. + map.addEventListener( + 'gmp-animationend', + () => { + map.flyCameraAround({ + // Location to fly around. + camera: flyToCamera, + // Length of time to fly to the location. + durationMillis: 50000, + // Number of rotations to make in the specified time. + repeatCount: 1, + }) + }, + { once: true } + ) // Stop animation after flying around. // At any time stop the animation. map.addEventListener('gmp-click', (event) => { - map.stopCameraAnimation(); - }); + map.stopCameraAnimation() + }) } -init(); +init() // [END maps_3d_camera_to_around] diff --git a/samples/3d-camera-to-around/style.css b/samples/3d-camera-to-around/style.css index 5557b807..f035eae3 100644 --- a/samples/3d-camera-to-around/style.css +++ b/samples/3d-camera-to-around/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_camera_to_around] */ diff --git a/samples/3d-label-toggle/index.html b/samples/3d-label-toggle/index.html index 334d8c19..f24ff2e2 100644 --- a/samples/3d-label-toggle/index.html +++ b/samples/3d-label-toggle/index.html @@ -6,20 +6,22 @@ --> - - Map + + Map - - - - -
+ + + + +
- + - - - + diff --git a/samples/3d-label-toggle/index.ts b/samples/3d-label-toggle/index.ts index c61661bc..f07e9c91 100644 --- a/samples/3d-label-toggle/index.ts +++ b/samples/3d-label-toggle/index.ts @@ -1,43 +1,58 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_label_toggle] -let map; +let map async function init() { - const { Map3DElement, MapMode } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, MapMode } = await google.maps.importLibrary('maps3d') - map = new Map3DElement( - { center: { lat: 37.79810773998413, lng: -122.41784275049939, altitude: 89.08476932205978 }, range: 6062.016931506805, tilt: 81.17100663963272, heading: -56.047035719765596, } - ); + map = new Map3DElement({ + center: { + lat: 37.79810773998413, + lng: -122.41784275049939, + altitude: 89.08476932205978, + }, + range: 6062.016931506805, + tilt: 81.17100663963272, + heading: -56.047035719765596, + }) - map.mode = MapMode.SATELLITE; + map.mode = MapMode.SATELLITE - document.body.append(map); + document.body.append(map) const locationCamera = { - center: { lat: 21.263523536467105, lng: -157.80663691939296, altitude: 80.28936069489404 }, - range: 1500.8202963253427, tilt: 76.9173260789542, heading: -44.59196007522445, - }; + center: { + lat: 21.263523536467105, + lng: -157.80663691939296, + altitude: 80.28936069489404, + }, + range: 1500.8202963253427, + tilt: 76.9173260789542, + heading: -44.59196007522445, + } // Get the button element by its ID - const toggleButton = document.getElementById('toggleButton'); + const toggleButton = document.getElementById('toggleButton') toggleButton.addEventListener('click', function () { // Toggle the labels. if (map.mode == MapMode.SATELLITE) { // Setting the map mode to HYBRID turns the labels on. - map.mode = MapMode.HYBRID; - document.getElementById('toggleButton').innerText = "Labels are on. (HYBRID)"; + map.mode = MapMode.HYBRID + document.getElementById('toggleButton').innerText = + 'Labels are on. (HYBRID)' } else { // Setting the map mode to SATELLITE turns the labels on. - map.mode = MapMode.SATELLITE; - document.getElementById('toggleButton').innerText = "Labels are off. (SATELLITE)"; + map.mode = MapMode.SATELLITE + document.getElementById('toggleButton').innerText = + 'Labels are off. (SATELLITE)' } - }); + }) } -init(); +init() // [END maps_3d_label_toggle] diff --git a/samples/3d-label-toggle/style.css b/samples/3d-label-toggle/style.css index 9c8246fc..3313da47 100644 --- a/samples/3d-label-toggle/style.css +++ b/samples/3d-label-toggle/style.css @@ -9,12 +9,12 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } .toggleButton { background: rgb(235, 235, 235); diff --git a/samples/3d-marker-click-event/index.html b/samples/3d-marker-click-event/index.html index 55362308..2125dda1 100644 --- a/samples/3d-marker-click-event/index.html +++ b/samples/3d-marker-click-event/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-marker-click-event/index.ts b/samples/3d-marker-click-event/index.ts index 8ef0c66b..5dafcf84 100644 --- a/samples/3d-marker-click-event/index.ts +++ b/samples/3d-marker-click-event/index.ts @@ -1,46 +1,50 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_marker_click_event] async function initMap() { // Include the interactive marker class - const { Map3DElement, Marker3DInteractiveElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, Marker3DInteractiveElement } = + await google.maps.importLibrary('maps3d') // We will use this to place the camrea for the intial view but also to fly around the starting point. const originalCamera = { - center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 }, range: 1500, tilt: 74, heading: 0 - }; + center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 }, + range: 1500, + tilt: 74, + heading: 0, + } const map = new Map3DElement({ ...originalCamera, - mode: "SATELLITE", - }); + mode: 'SATELLITE', + }) // Create the interactive marker and set the attributes. const interactiveMarker = new Marker3DInteractiveElement({ position: { lat: 39.1178, lng: -106.4452, altitude: 100 }, - altitudeMode: "RELATIVE_TO_MESH", + altitudeMode: 'RELATIVE_TO_MESH', extruded: true, - label: "Mount Elbert" - }); + label: 'Mount Elbert', + }) // Specify the action to take on click. interactiveMarker.addEventListener('gmp-click', (event) => { map.flyCameraAround({ camera: originalCamera, durationMillis: 50000, - repeatCount: 1 - }); - }); + repeatCount: 1, + }) + }) - map.append(interactiveMarker); + map.append(interactiveMarker) - document.body.append(map); + document.body.append(map) } -initMap(); +initMap() // [END maps_3d_marker_click_event] diff --git a/samples/3d-marker-click-event/style.css b/samples/3d-marker-click-event/style.css index b6434892..a63da382 100644 --- a/samples/3d-marker-click-event/style.css +++ b/samples/3d-marker-click-event/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_marker_click_event] */ diff --git a/samples/3d-marker-collision-behavior/index.html b/samples/3d-marker-collision-behavior/index.html index c555747a..4de9b2d3 100644 --- a/samples/3d-marker-collision-behavior/index.html +++ b/samples/3d-marker-collision-behavior/index.html @@ -6,27 +6,31 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - - - - + + + + diff --git a/samples/3d-marker-collision-behavior/index.ts b/samples/3d-marker-collision-behavior/index.ts index e205e724..7f9bd1b4 100644 --- a/samples/3d-marker-collision-behavior/index.ts +++ b/samples/3d-marker-collision-behavior/index.ts @@ -1,35 +1,36 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_marker_collision_behavior] -const markers = []; +const markers = [] async function init() { // Request needed libraries. - const { Map3DElement, MapMode, Marker3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, MapMode, Marker3DElement } = + await google.maps.importLibrary('maps3d') const map = new Map3DElement({ - center: { lat: 47.6094, lng: -122.3390, altitude: 0 }, + center: { lat: 47.6094, lng: -122.339, altitude: 0 }, range: 1000, mode: MapMode.HYBRID, - }); + }) for (const [lng, lat] of positions) { const marker = new Marker3DElement({ - position: {lat, lng}, + position: { lat, lng }, // Try setting a different collision behavior here. - collisionBehavior: google.maps.CollisionBehavior.REQUIRED - }); + collisionBehavior: google.maps.CollisionBehavior.REQUIRED, + }) markers.push(marker) - map.append(marker); + map.append(marker) } - document.body.append(map); + document.body.append(map) } const positions = [ @@ -46,16 +47,17 @@ const positions = [ [-122.3379, 47.6093], [-122.3381, 47.6095], [-122.3378, 47.6095], -]; +] -init(); +init() -const dropdown = document.getElementById('selectElementId'); -dropdown.addEventListener('change', drawMap); +const dropdown = document.getElementById('selectElementId') +dropdown.addEventListener('change', drawMap) function drawMap(event) { for (const marker of markers) { - marker.collisionBehavior = dropdown.value || google.maps.CollisionBehavior.REQUIRED; + marker.collisionBehavior = + dropdown.value || google.maps.CollisionBehavior.REQUIRED } } diff --git a/samples/3d-marker-collision-behavior/style.css b/samples/3d-marker-collision-behavior/style.css index 6dfc5e12..6594b260 100644 --- a/samples/3d-marker-collision-behavior/style.css +++ b/samples/3d-marker-collision-behavior/style.css @@ -9,15 +9,15 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } selector { padding: 2px; float: right; -} +} /* [END maps_3d_marker_collision_behavior] */ diff --git a/samples/3d-marker-customization/index.html b/samples/3d-marker-customization/index.html index df026d78..997ce267 100644 --- a/samples/3d-marker-customization/index.html +++ b/samples/3d-marker-customization/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + - \ No newline at end of file + diff --git a/samples/3d-marker-customization/index.ts b/samples/3d-marker-customization/index.ts index f0387863..ecbff5e6 100644 --- a/samples/3d-marker-customization/index.ts +++ b/samples/3d-marker-customization/index.ts @@ -1,56 +1,57 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_marker_customization] async function init() { - const { Map3DElement, Marker3DElement } = await google.maps.importLibrary("maps3d"); - const { PinElement } = await google.maps.importLibrary("marker"); + const { Map3DElement, Marker3DElement } = + await google.maps.importLibrary('maps3d') + const { PinElement } = await google.maps.importLibrary('marker') const map = new Map3DElement({ center: { lat: 37.4176, lng: -122.02, altitude: 0 }, tilt: 67.5, range: 7000, - mode: 'HYBRID' - }); + mode: 'HYBRID', + }) - map.mode = "SATELLITE"; + map.mode = 'SATELLITE' // Change the border color. const pinBorder = new PinElement({ borderColor: '#FFFFFF', - }); + }) const markerWithBorder = new Marker3DElement({ position: { lat: 37.415, lng: -122.035 }, - }); - markerWithBorder.append(pinBorder); + }) + markerWithBorder.append(pinBorder) // Add a label. const markerWithLabel = new Marker3DElement({ position: { lat: 37.419, lng: -122.03 }, - label: 'Simple label' - }); + label: 'Simple label', + }) // Adjust the scale. const pinScaled = new PinElement({ scale: 1.5, - }); + }) const markerWithScale = new Marker3DElement({ position: { lat: 37.419, lng: -122.02 }, - }); - markerWithScale.append(pinScaled); + }) + markerWithScale.append(pinScaled) // Change the glyph color. const pinGlyph = new PinElement({ glyphColor: 'white', - }); + }) const markerWithGlyphColor = new Marker3DElement({ position: { lat: 37.415, lng: -122.025 }, - }); - markerWithGlyphColor.append(pinGlyph); + }) + markerWithGlyphColor.append(pinGlyph) // Change many elements together and extrude marker. const pinTextGlyph = new PinElement({ @@ -58,43 +59,43 @@ async function init() { glyph: 'E', glyphColor: 'red', borderColor: '#0000FF', - }); + }) const markerWithGlyphText = new Marker3DElement({ position: { lat: 37.415, lng: -122.015, altitude: 50 }, extruded: true, - altitudeMode: "RELATIVE_TO_GROUND", - }); - markerWithGlyphText.append(pinTextGlyph); + altitudeMode: 'RELATIVE_TO_GROUND', + }) + markerWithGlyphText.append(pinTextGlyph) // Hide the glyph. const pinNoGlyph = new PinElement({ glyph: '', - }); + }) const markerWithNoGlyph = new Marker3DElement({ position: { lat: 37.415, lng: -122.005 }, - }); - markerWithNoGlyph.append(pinNoGlyph); + }) + markerWithNoGlyph.append(pinNoGlyph) // Change the background color. const pinBackground = new PinElement({ background: '#FBBC04', - }); + }) const markerWithBackground = new Marker3DElement({ position: { lat: 37.419, lng: -122.01 }, - }); - markerWithBackground.append(pinBackground); + }) + markerWithBackground.append(pinBackground) - map.append(markerWithLabel); - map.append(markerWithScale); - map.append(markerWithBackground); - map.append(markerWithBorder); - map.append(markerWithGlyphColor); - map.append(markerWithGlyphText); - map.append(markerWithNoGlyph); + map.append(markerWithLabel) + map.append(markerWithScale) + map.append(markerWithBackground) + map.append(markerWithBorder) + map.append(markerWithGlyphColor) + map.append(markerWithGlyphText) + map.append(markerWithNoGlyph) - document.body.append(map); + document.body.append(map) } -init(); +init() // [END maps_3d_marker_customization] diff --git a/samples/3d-marker-customization/style.css b/samples/3d-marker-customization/style.css index efbeb555..caa73d3b 100644 --- a/samples/3d-marker-customization/style.css +++ b/samples/3d-marker-customization/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_marker_customization] */ diff --git a/samples/3d-marker-graphics/index.html b/samples/3d-marker-graphics/index.html index e7657257..f99a9092 100644 --- a/samples/3d-marker-graphics/index.html +++ b/samples/3d-marker-graphics/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-marker-graphics/index.ts b/samples/3d-marker-graphics/index.ts index 189857f6..de686d3d 100644 --- a/samples/3d-marker-graphics/index.ts +++ b/samples/3d-marker-graphics/index.ts @@ -1,95 +1,107 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_marker_graphics] async function init() { - const { Map3DElement, Marker3DElement } = await google.maps.importLibrary('maps3d'); - const { PinElement } = await google.maps.importLibrary('marker'); - const { Place } = await google.maps.importLibrary('places'); + const { Map3DElement, Marker3DElement } = + await google.maps.importLibrary('maps3d') + const { PinElement } = await google.maps.importLibrary('marker') + const { Place } = await google.maps.importLibrary('places') const map = new Map3DElement({ center: { lat: 37.426, lng: -122.082, altitude: 18 }, tilt: 67.5, - range: 4000, - mode: 'SATELLITE' - }); + range: 4000, + mode: 'SATELLITE', + }) // A marker with a with a URL pointing to a PNG. - const beachFlagImg = document.createElement('img'); - beachFlagImg.src = new URL('images/beachflag.png', import.meta.url); + const beachFlagImg = document.createElement('img') + beachFlagImg.src = new URL('images/beachflag.png', import.meta.url) const beachFlagMarker = new Marker3DElement({ position: { lat: 37.434, lng: -122.082 }, - }); - const templateForImg = document.createElement('template'); - templateForImg.content.append(beachFlagImg); - beachFlagMarker.append(templateForImg); + }) + const templateForImg = document.createElement('template') + templateForImg.content.append(beachFlagImg) + beachFlagMarker.append(templateForImg) - map.append(beachFlagMarker); + map.append(beachFlagMarker) // A marker with a custom SVG glyph and white background. - const glyphImgUrl = 'https://www.gstatic.com/images/branding/productlogos/maps/v7/192px.svg'; + const glyphImgUrl = + 'https://www.gstatic.com/images/branding/productlogos/maps/v7/192px.svg' const glyphSvgPinElement = new PinElement({ background: 'white', glyph: new URL(glyphImgUrl), - }); + }) const glyphSvgMarker = new Marker3DElement({ position: { lat: 37.425, lng: -122.07, altitude: 100 }, extruded: true, - altitudeMode: "ABSOLUTE" - }); - glyphSvgMarker.append(glyphSvgPinElement); + altitudeMode: 'ABSOLUTE', + }) + glyphSvgMarker.append(glyphSvgPinElement) try { - map.append(glyphSvgMarker); + map.append(glyphSvgMarker) } catch (error) { - console.error(error); + console.error(error) } // A marker customized using a place icon and color, name, and geometry. const place = new Place({ id: 'ChIJN5Nz71W3j4ARhx5bwpTQEGg', - }); + }) // Call fetchFields, passing the desired data fields. - await place.fetchFields({ fields: ['location', 'displayName', 'svgIconMaskURI', 'iconBackgroundColor'] }); + await place.fetchFields({ + fields: [ + 'location', + 'displayName', + 'svgIconMaskURI', + 'iconBackgroundColor', + ], + }) const pinElement = new PinElement({ background: place.iconBackgroundColor, glyph: new URL(String(place.svgIconMaskURI)), - }); + }) const placeIconMarker = new Marker3DElement({ position: place.location, - }); - placeIconMarker.append(pinElement); + }) + placeIconMarker.append(pinElement) - map.append(placeIconMarker); + map.append(placeIconMarker) // Used to parse the SVG string. - const parser = new DOMParser(); + const parser = new DOMParser() // A marker with a custom inline SVG. - const pinSvgString = ''; + const pinSvgString = + '' // Read the svg string. - const pinSvg = - parser.parseFromString(pinSvgString, 'image/svg+xml').documentElement; + const pinSvg = parser.parseFromString( + pinSvgString, + 'image/svg+xml' + ).documentElement const markerWithCustomSvg = new Marker3DElement({ position: { lat: 37.425, lng: -122.094 }, - }); - const templateForSvg = document.createElement('template'); - templateForSvg.content.append(pinSvg); - markerWithCustomSvg.append(templateForSvg); + }) + const templateForSvg = document.createElement('template') + templateForSvg.content.append(pinSvg) + markerWithCustomSvg.append(templateForSvg) - map.append(markerWithCustomSvg); + map.append(markerWithCustomSvg) - document.body.append(map); + document.body.append(map) } -init(); +init() // [END maps_3d_marker_graphics] diff --git a/samples/3d-marker-graphics/style.css b/samples/3d-marker-graphics/style.css index 824704a3..8c488040 100644 --- a/samples/3d-marker-graphics/style.css +++ b/samples/3d-marker-graphics/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_marker_graphics] */ diff --git a/samples/3d-marker-interactive/index.html b/samples/3d-marker-interactive/index.html index 18a7fd77..b9bf1651 100644 --- a/samples/3d-marker-interactive/index.html +++ b/samples/3d-marker-interactive/index.html @@ -6,22 +6,24 @@ --> - - Map + + Map - - - - -
- -
-
Click on a marker to get the name of the Google Office.
-
+ + + + +
- - - + diff --git a/samples/3d-marker-interactive/index.ts b/samples/3d-marker-interactive/index.ts index 81fad67f..6d80a687 100644 --- a/samples/3d-marker-interactive/index.ts +++ b/samples/3d-marker-interactive/index.ts @@ -1,84 +1,96 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_marker_interactive] async function init() { // Request needed libraries. - const { Map3DElement, Marker3DInteractiveElement, PopoverElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, Marker3DInteractiveElement, PopoverElement } = + await google.maps.importLibrary('maps3d') const map = new Map3DElement({ - center: { lat: 37.4690, lng: -122.1074, altitude: 0 }, + center: { lat: 37.469, lng: -122.1074, altitude: 0 }, tilt: 67.5, range: 45000, - mode: 'HYBRID' - }); + mode: 'HYBRID', + }) - map.mode = "SATELLITE"; + map.mode = 'SATELLITE' for (const position of positions) { const popover = new PopoverElement({ open: true, - }); + }) - popover.append(position.name); + popover.append(position.name) const interactiveMarker = new Marker3DInteractiveElement({ position, - gmpPopoverTargetElement: popover - }); + gmpPopoverTargetElement: popover, + }) - map.append(interactiveMarker); - map.append(popover); + map.append(interactiveMarker) + map.append(popover) } - document.body.append(map); + document.body.append(map) } -const positions = [{ - lat: 37.50981071450543, - lng: -122.20280629839084, - name: "Google Redwood City", -}, { - lat: 37.423897572754754, - lng: -122.09167346506989, - name: "Google West Campus", -}, { - lat: 37.42333982824077, - lng: -122.06647571637265, - name: "Google Bay View", -}, { - lat: 37.42193728115661, - lng: -122.08531908774293, - name: "Googleplex", -}, { - lat: 37.39982552146971, - lng: -122.057934225745, - name: "Google Quad Campus", -}, { - lat: 37.40317922575345, - lng: -122.03276863941647, - name: "Google Tech Corners", -}, { - lat: 37.41181058680138, - lng: -121.9538960231151, - name: "Google San Jose", -}, { - lat: 37.62759428242346, - lng: -122.42615377188994, - name: "Google San Bruno", -}, { - lat: 37.40369749797231, - lng: -122.14812537955007, - name: "Google Palo Alto", -}, { - lat: 37.793664664297964, - lng: -122.39504580413139, - name: "Google San Francisco", -}]; +const positions = [ + { + lat: 37.50981071450543, + lng: -122.20280629839084, + name: 'Google Redwood City', + }, + { + lat: 37.423897572754754, + lng: -122.09167346506989, + name: 'Google West Campus', + }, + { + lat: 37.42333982824077, + lng: -122.06647571637265, + name: 'Google Bay View', + }, + { + lat: 37.42193728115661, + lng: -122.08531908774293, + name: 'Googleplex', + }, + { + lat: 37.39982552146971, + lng: -122.057934225745, + name: 'Google Quad Campus', + }, + { + lat: 37.40317922575345, + lng: -122.03276863941647, + name: 'Google Tech Corners', + }, + { + lat: 37.41181058680138, + lng: -121.9538960231151, + name: 'Google San Jose', + }, + { + lat: 37.62759428242346, + lng: -122.42615377188994, + name: 'Google San Bruno', + }, + { + lat: 37.40369749797231, + lng: -122.14812537955007, + name: 'Google Palo Alto', + }, + { + lat: 37.793664664297964, + lng: -122.39504580413139, + name: 'Google San Francisco', + }, +] -init(); +init() // [END maps_3d_marker_interactive] diff --git a/samples/3d-marker-interactive/style.css b/samples/3d-marker-interactive/style.css index ef9f6866..7f1541c7 100644 --- a/samples/3d-marker-interactive/style.css +++ b/samples/3d-marker-interactive/style.css @@ -9,18 +9,21 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } .textContainer { background-color: #4d90fe; box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3); margin: 10px; - font: 400 18px Roboto, Arial, sans-serif; + font: + 400 18px Roboto, + Arial, + sans-serif; overflow: hidden; position: absolute; left: 50%; diff --git a/samples/3d-model-interactive/index.html b/samples/3d-model-interactive/index.html index 8d861fdf..34f99751 100644 --- a/samples/3d-model-interactive/index.html +++ b/samples/3d-model-interactive/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-model-interactive/index.ts b/samples/3d-model-interactive/index.ts index 408fe8e0..4c2982f5 100644 --- a/samples/3d-model-interactive/index.ts +++ b/samples/3d-model-interactive/index.ts @@ -1,36 +1,40 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_model_interactive] async function init() { // Import the needed libraries. - const { Map3DElement, Model3DInteractiveElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, Model3DInteractiveElement } = + await google.maps.importLibrary('maps3d') const map = new Map3DElement({ - center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 }, range: 1500, tilt: 74, heading: 0, - mode: "HYBRID", - }); + center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 }, + range: 1500, + tilt: 74, + heading: 0, + mode: 'HYBRID', + }) const model = new Model3DInteractiveElement({ src: 'https://maps-docs-team.web.app/assets/windmill.glb', position: { lat: 39.1178, lng: -106.4452, altitude: 4495.4952 }, orientation: { heading: 0, tilt: 270, roll: 90 }, - scale: .15, - altitudeMode: "CLAMP_TO_GROUND", - }); + scale: 0.15, + altitudeMode: 'CLAMP_TO_GROUND', + }) model.addEventListener('gmp-click', (event) => { - const clickedModel = event.target; - clickedModel.scale = Math.random() * (0.5 - 0.1) + 0.1; - }); + const clickedModel = event.target + clickedModel.scale = Math.random() * (0.5 - 0.1) + 0.1 + }) - document.body.append(map); - map.append(model); + document.body.append(map) + map.append(model) } -init(); +init() // [END maps_3d_model_interactive] diff --git a/samples/3d-model-interactive/style.css b/samples/3d-model-interactive/style.css index 4e3e2176..0e00f81a 100644 --- a/samples/3d-model-interactive/style.css +++ b/samples/3d-model-interactive/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_model_interactive] */ diff --git a/samples/3d-model/index.html b/samples/3d-model/index.html index a092e8be..61156e1a 100644 --- a/samples/3d-model/index.html +++ b/samples/3d-model/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-model/index.ts b/samples/3d-model/index.ts index 0ceb71e4..b024612b 100644 --- a/samples/3d-model/index.ts +++ b/samples/3d-model/index.ts @@ -1,31 +1,35 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_model] async function init() { // Import the needed libraries. - const { Map3DElement, Model3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, Model3DElement } = + await google.maps.importLibrary('maps3d') const map = new Map3DElement({ - center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 }, range: 1500, tilt: 74, heading: 0, - mode: "HYBRID", - }); + center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 }, + range: 1500, + tilt: 74, + heading: 0, + mode: 'HYBRID', + }) const model = new Model3DElement({ src: 'https://maps-docs-team.web.app/assets/windmill.glb', position: { lat: 39.1178, lng: -106.4452, altitude: 4495.4952 }, orientation: { heading: 0, tilt: 270, roll: 90 }, - scale: .15, - altitudeMode: "CLAMP_TO_GROUND", - }); + scale: 0.15, + altitudeMode: 'CLAMP_TO_GROUND', + }) - document.body.append(map); - map.append(model); + document.body.append(map) + map.append(model) } -init(); +init() // [END maps_3d_model] diff --git a/samples/3d-model/style.css b/samples/3d-model/style.css index 08e915d2..6fbc060e 100644 --- a/samples/3d-model/style.css +++ b/samples/3d-model/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_model] */ diff --git a/samples/3d-places-autocomplete/index.html b/samples/3d-places-autocomplete/index.html index 18c0c9ce..524e261e 100644 --- a/samples/3d-places-autocomplete/index.html +++ b/samples/3d-places-autocomplete/index.html @@ -6,24 +6,23 @@ --> - - Map + + Map - - - - -
+ + + + +
-
-
Navigate to a place
-
+
+
Navigate to a place
+
-
- - - + diff --git a/samples/3d-places-autocomplete/index.ts b/samples/3d-places-autocomplete/index.ts index 70675f41..2ae62225 100644 --- a/samples/3d-places-autocomplete/index.ts +++ b/samples/3d-places-autocomplete/index.ts @@ -1,15 +1,15 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_places_autocomplete] -let map = null; +let map = null async function init() { - const { Map3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement } = await google.maps.importLibrary('maps3d') map = new Map3DElement({ center: { lat: 0, lng: 0, altitude: 16000000 }, @@ -17,81 +17,100 @@ async function init() { range: 0, heading: 0, roll: 0, - mode: 'HYBRID' - }); + mode: 'HYBRID', + }) - document.body.append(map); + document.body.append(map) - initAutocomplete(); + initAutocomplete() } async function initAutocomplete() { - const { PlaceAutocompleteElement } = await google.maps.importLibrary("places") - - const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement(); - placeAutocomplete.id = 'place-autocomplete-input'; - const card = document.getElementById('pac-container'); - card.appendChild(placeAutocomplete); - - placeAutocomplete.addEventListener('gmp-select', async ({ placePrediction }) => { - const place = placePrediction.toPlace(); - await place.fetchFields({ fields: ['displayName', 'location', 'id'] }); - // If the place has a geometry, then present it on a map. - if (!place.location) { - window.alert("No viewport for input: " + place.displayName); - return; + const { PlaceAutocompleteElement } = + await google.maps.importLibrary('places') + + const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement() + placeAutocomplete.id = 'place-autocomplete-input' + const card = document.getElementById('pac-container') + card.appendChild(placeAutocomplete) + + placeAutocomplete.addEventListener( + 'gmp-select', + async ({ placePrediction }) => { + const place = placePrediction.toPlace() + await place.fetchFields({ + fields: ['displayName', 'location', 'id'], + }) + // If the place has a geometry, then present it on a map. + if (!place.location) { + window.alert('No viewport for input: ' + place.displayName) + return + } + flyToPlace(place) } - flyToPlace(place); - }); + ) } const flyToPlace = async (place) => { - const { AltitudeMode, Polyline3DElement, Polygon3DElement, Marker3DElement } = await google.maps.importLibrary("maps3d"); + const { + AltitudeMode, + Polyline3DElement, + Polygon3DElement, + Marker3DElement, + } = await google.maps.importLibrary('maps3d') - const location = place.location; + const location = place.location // We need to find the elevation for the point so we place the marker at 50m above the elevation. - const elevation = await getElevationforPoint(location); + const elevation = await getElevationforPoint(location) const marker = new Marker3DElement({ - position: { lat: location.lat(), lng: location.lng(), altitude: elevation + 50 }, + position: { + lat: location.lat(), + lng: location.lng(), + altitude: elevation + 50, + }, altitudeMode: AltitudeMode.ABSOLUTE, extruded: true, label: place.displayName, - }); + }) // Add the marker. - map.append(marker); + map.append(marker) // Fly to the marker. map.flyCameraTo({ endCamera: { - center: { lat: location.lat(), lng: location.lng(), altitude: elevation + 50 }, + center: { + lat: location.lat(), + lng: location.lng(), + altitude: elevation + 50, + }, tilt: 65, heading: 0, - range: 1000 + range: 1000, }, durationMillis: 10000, - }); -}; + }) +} async function getElevationforPoint(location) { - const { ElevationService } = await google.maps.importLibrary("elevation"); + const { ElevationService } = await google.maps.importLibrary('elevation') // Get place elevation using the ElevationService. - const elevatorService = new google.maps.ElevationService(); + const elevatorService = new google.maps.ElevationService() const elevationResponse = await elevatorService.getElevationForLocations({ locations: [location], - }); + }) if (!(elevationResponse.results && elevationResponse.results.length)) { - window.alert(`Insufficient elevation data for place: ${place.name}`); - return; + window.alert(`Insufficient elevation data for place: ${place.name}`) + return } - const elevation = elevationResponse.results[0].elevation || 10; + const elevation = elevationResponse.results[0].elevation || 10 - return elevation; + return elevation } -init(); +init() // [END maps_3d_places_autocomplete] diff --git a/samples/3d-places-autocomplete/style.css b/samples/3d-places-autocomplete/style.css index 785b9f19..e1965f66 100644 --- a/samples/3d-places-autocomplete/style.css +++ b/samples/3d-places-autocomplete/style.css @@ -9,12 +9,12 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } .pac-controls { display: inline-block; @@ -34,7 +34,10 @@ body { box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3); margin: 10px; padding: 0 0.5em; - font: 400 18px Roboto, Arial, sans-serif; + font: + 400 18px Roboto, + Arial, + sans-serif; /* overflow: hidden; */ font-family: Roboto; padding: 0; diff --git a/samples/3d-places/index.html b/samples/3d-places/index.html index 1f39e940..549e9e87 100644 --- a/samples/3d-places/index.html +++ b/samples/3d-places/index.html @@ -6,26 +6,26 @@ --> - - Map + + Map - - - - -
+ + + + +
- - -
-
-
-
-
-
-
Click on a place to get details.
-
- +
+
+
+
+
+
+
Click on a place to get details.
+
+ diff --git a/samples/3d-places/index.ts b/samples/3d-places/index.ts index 75a69754..886c06a2 100644 --- a/samples/3d-places/index.ts +++ b/samples/3d-places/index.ts @@ -1,43 +1,46 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ //@ts-nocheck // [START maps_3d_places] -let map3DElement = null; +let map3DElement = null async function init() { - const { Map3DElement } = await google.maps.importLibrary("maps3d"); - { } + const { Map3DElement } = await google.maps.importLibrary('maps3d') + { + } map3DElement = new Map3DElement({ - center: { lat: 51.532, lng : -0.124, altitude: 30 }, - range: 1400, + center: { lat: 51.532, lng: -0.124, altitude: 30 }, + range: 1400, tilt: 64, heading: -5, - mode: 'HYBRID' - }); + mode: 'HYBRID', + }) - document.body.append(map3DElement); + document.body.append(map3DElement) map3DElement.addEventListener('gmp-click', async (event) => { - event.preventDefault(); + event.preventDefault() if (event.placeId) { - const place = await event.fetchPlace(); - await place.fetchFields({ fields: ['*'] }); + const place = await event.fetchPlace() + await place.fetchFields({ fields: ['*'] }) // Display place details. - document.getElementById("placeName").innerHTML = "Name :
 " + place.displayName; - document.getElementById("placeId").innerHTML = "Id :
 " + place.id; - document.getElementById("placeType").innerHTML = "Types :"; - + document.getElementById('placeName').innerHTML = + 'Name :
 ' + place.displayName + document.getElementById('placeId').innerHTML = + 'Id :
 ' + place.id + document.getElementById('placeType').innerHTML = 'Types :' + for (const type of place.types) { - document.getElementById("placeType").innerHTML += "
 " + type ; + document.getElementById('placeType').innerHTML += + '
 ' + type } - document.getElementById("details").style.display = "block"; + document.getElementById('details').style.display = 'block' } - }); - + }) } -init(); +init() // [END maps_3d_places] diff --git a/samples/3d-places/style.css b/samples/3d-places/style.css index 85bfe863..072544cb 100644 --- a/samples/3d-places/style.css +++ b/samples/3d-places/style.css @@ -12,7 +12,15 @@ body { height: 100%; margin: 0; padding: 0; - font-family: "Centra No2", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + font-family: + 'Centra No2', + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + 'Helvetica Neue', + Arial, + sans-serif; font-size: 0.9em; } @@ -36,10 +44,10 @@ body { overflow: hidden; position: absolute; top: 100px; - left : 10px; + left: 10px; padding: 10px; z-index: 1000; - display:none; + display: none; color: white; border-radius: 15px; } diff --git a/samples/3d-polygon-click-event/index.html b/samples/3d-polygon-click-event/index.html index 0383e4f4..8146aa5d 100644 --- a/samples/3d-polygon-click-event/index.html +++ b/samples/3d-polygon-click-event/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-polygon-click-event/index.ts b/samples/3d-polygon-click-event/index.ts index 849bed12..a81cb559 100644 --- a/samples/3d-polygon-click-event/index.ts +++ b/samples/3d-polygon-click-event/index.ts @@ -1,69 +1,72 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_polygon_click_event] async function init() { - const { Map3DElement, MapMode, Polygon3DInteractiveElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, MapMode, Polygon3DInteractiveElement } = + await google.maps.importLibrary('maps3d') const map = new Map3DElement({ center: { lat: 40.6842, lng: -74.0019, altitude: 1000 }, heading: 340, tilt: 70, mode: MapMode.HYBRID, - }); + }) - document.body.append(map); + document.body.append(map) const polygonOptions = { - strokeColor: "#0000ff80", + strokeColor: '#0000ff80', strokeWidth: 8, - fillColor: "#ff000080", + fillColor: '#ff000080', drawsOccludedSegments: false, } - const examplePolygon = new google.maps.maps3d.Polygon3DInteractiveElement(polygonOptions); + const examplePolygon = new google.maps.maps3d.Polygon3DInteractiveElement( + polygonOptions + ) examplePolygon.path = [ { lat: 40.7144, lng: -74.0208 }, { lat: 40.6993, lng: -74.019 }, { lat: 40.7035, lng: -74.0004 }, - { lat: 40.7144, lng: -74.0208 } - ]; + { lat: 40.7144, lng: -74.0208 }, + ] examplePolygon.addEventListener('gmp-click', (event) => { // change the color of the polygon stroke and fill colors to a random alternatives! - event.target.fillColor = randomizeHexColor(event.target.fillColor); - event.target.strokeColor = randomizeHexColor(event.target.fillColor); - console.log(event); - }); + event.target.fillColor = randomizeHexColor(event.target.fillColor) + event.target.strokeColor = randomizeHexColor(event.target.fillColor) + console.log(event) + }) - map.append(examplePolygon); + map.append(examplePolygon) } function randomizeHexColor(originalHexColor) { - console.log(originalHexColor); - let alpha = ''; - alpha = originalHexColor.substring(7); + console.log(originalHexColor) + let alpha = '' + alpha = originalHexColor.substring(7) // Generate random values for Red, Green, Blue (0-255) - const r = Math.floor(Math.random() * 256); - const g = Math.floor(Math.random() * 256); - const b = Math.floor(Math.random() * 256); + const r = Math.floor(Math.random() * 256) + const g = Math.floor(Math.random() * 256) + const b = Math.floor(Math.random() * 256) - console.log(r + " " + g + " " + b); + console.log(r + ' ' + g + ' ' + b) // Convert decimal to 2-digit hex, padding with '0' if needed - const rHex = ('0' + r.toString(16)).slice(-2); - const gHex = ('0' + g.toString(16)).slice(-2); - const bHex = ('0' + b.toString(16)).slice(-2); + const rHex = ('0' + r.toString(16)).slice(-2) + const gHex = ('0' + g.toString(16)).slice(-2) + const bHex = ('0' + b.toString(16)).slice(-2) // Combine parts: '#' + random RGB + original Alpha (if any) - return `#${rHex}${gHex}${bHex}${alpha}`; + return `#${rHex}${gHex}${bHex}${alpha}` } -init(); +init() // [END maps_3d_polygon_click_event] diff --git a/samples/3d-polygon-click-event/style.css b/samples/3d-polygon-click-event/style.css index f0bba123..2a89f955 100644 --- a/samples/3d-polygon-click-event/style.css +++ b/samples/3d-polygon-click-event/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_polygon_click_event] */ diff --git a/samples/3d-polygon-extruded-hole/index.html b/samples/3d-polygon-extruded-hole/index.html index d7a6cd6f..e034bda2 100644 --- a/samples/3d-polygon-extruded-hole/index.html +++ b/samples/3d-polygon-extruded-hole/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-polygon-extruded-hole/index.ts b/samples/3d-polygon-extruded-hole/index.ts index 53c1c6bf..30c4d54e 100644 --- a/samples/3d-polygon-extruded-hole/index.ts +++ b/samples/3d-polygon-extruded-hole/index.ts @@ -1,50 +1,53 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_polygon_extruded_hole] async function init() { - const { Map3DElement, MapMode, AltitudeMode, Polygon3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, MapMode, AltitudeMode, Polygon3DElement } = + await google.maps.importLibrary('maps3d') const map3DElement = new Map3DElement({ center: { lat: 40.6842, lng: -74.0019, altitude: 1000 }, heading: 340, tilt: 70, mode: MapMode.HYBRID, - }); + }) const polygonOptions = { - strokeColor: "#0000ff80", + strokeColor: '#0000ff80', strokeWidth: 8, - fillColor: "#ff000080", + fillColor: '#ff000080', drawsOccludedSegments: false, extruded: true, - altitudeMode : AltitudeMode.RELATIVE_TO_GROUND + altitudeMode: AltitudeMode.RELATIVE_TO_GROUND, } - const examplePolygon = new google.maps.maps3d.Polygon3DElement(polygonOptions); + const examplePolygon = new google.maps.maps3d.Polygon3DElement( + polygonOptions + ) examplePolygon.path = [ { lat: 40.7144, lng: -74.0208, altitude: 200 }, { lat: 40.6993, lng: -74.019, altitude: 200 }, - { lat: 40.7035, lng: -74.0004, altitude: 200 } - ]; + { lat: 40.7035, lng: -74.0004, altitude: 200 }, + ] examplePolygon.innerPaths = [ [ { lat: 40.71, lng: -74.0175, altitude: 200 }, { lat: 40.703, lng: -74.0165, altitude: 200 }, - { lat: 40.7035, lng: -74.006, altitude: 200 } - ] - ]; + { lat: 40.7035, lng: -74.006, altitude: 200 }, + ], + ] - map3DElement.append(examplePolygon); + map3DElement.append(examplePolygon) - document.body.append(map3DElement); + document.body.append(map3DElement) } -init(); +init() // [END maps_3d_polygon_extruded_hole] diff --git a/samples/3d-polygon-extruded-hole/style.css b/samples/3d-polygon-extruded-hole/style.css index 81dc8ef9..2fbbb162 100644 --- a/samples/3d-polygon-extruded-hole/style.css +++ b/samples/3d-polygon-extruded-hole/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_polygon_extruded_hole] */ diff --git a/samples/3d-polygon/index.html b/samples/3d-polygon/index.html index 511cf4f6..197a98d0 100644 --- a/samples/3d-polygon/index.html +++ b/samples/3d-polygon/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-polygon/index.ts b/samples/3d-polygon/index.ts index ef63c38d..e4d01f2c 100644 --- a/samples/3d-polygon/index.ts +++ b/samples/3d-polygon/index.ts @@ -1,40 +1,43 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_polygon] async function init() { - const { Map3DElement, MapMode, Polygon3DElement } = await google.maps.importLibrary("maps3d"); - + const { Map3DElement, MapMode, Polygon3DElement } = + await google.maps.importLibrary('maps3d') + const map3DElement = new Map3DElement({ center: { lat: 40.6842, lng: -74.0019, altitude: 1000 }, heading: 340, tilt: 70, mode: MapMode.HYBRID, - }); + }) const polygonOptions = { - strokeColor: "#0000ff80", + strokeColor: '#0000ff80', strokeWidth: 8, - fillColor: "#ff000080", + fillColor: '#ff000080', drawsOccludedSegments: false, } - const examplePolygon = new google.maps.maps3d.Polygon3DElement(polygonOptions); + const examplePolygon = new google.maps.maps3d.Polygon3DElement( + polygonOptions + ) examplePolygon.path = [ { lat: 40.7144, lng: -74.0208 }, { lat: 40.6993, lng: -74.019 }, - { lat: 40.7035, lng: -74.0004 } - ]; + { lat: 40.7035, lng: -74.0004 }, + ] - map3DElement.append(examplePolygon); + map3DElement.append(examplePolygon) - document.body.append(map3DElement); + document.body.append(map3DElement) } -init(); +init() // [END maps_3d_polygon] diff --git a/samples/3d-polygon/style.css b/samples/3d-polygon/style.css index 04901599..53f5c208 100644 --- a/samples/3d-polygon/style.css +++ b/samples/3d-polygon/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_polygon] */ diff --git a/samples/3d-polyline-click-event/index.html b/samples/3d-polyline-click-event/index.html index 6da0ceb9..3e7daf08 100644 --- a/samples/3d-polyline-click-event/index.html +++ b/samples/3d-polyline-click-event/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-polyline-click-event/index.ts b/samples/3d-polyline-click-event/index.ts index d018216e..095d0b0c 100644 --- a/samples/3d-polyline-click-event/index.ts +++ b/samples/3d-polyline-click-event/index.ts @@ -1,21 +1,29 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_polyline_click_event] -let map; +let map async function init() { - const { Map3DElement, MapMode, AltitudeMode, Polyline3DInteractiveElement } = await google.maps.importLibrary("maps3d"); + const { + Map3DElement, + MapMode, + AltitudeMode, + Polyline3DInteractiveElement, + } = await google.maps.importLibrary('maps3d') - map = new Map3DElement({ - center: { lat: 37.7927, lng : -122.4020, altitude: 65.93 }, range: 3362.87, tilt: 64.01 ,heading: 25.00, + map = new Map3DElement({ + center: { lat: 37.7927, lng: -122.402, altitude: 65.93 }, + range: 3362.87, + tilt: 64.01, + heading: 25.0, mode: MapMode.SATELLITE, - }); + }) - document.body.append(map); + document.body.append(map) const polyline = new Polyline3DInteractiveElement({ coordinates: [ @@ -29,23 +37,23 @@ async function init() { { lat: 37.78861484290265, lng: -122.4019489189814 }, { lat: 37.78618687561075, lng: -122.398969592545 }, { lat: 37.7892310309145, lng: -122.3951458683092 }, - { lat: 37.7916358762409, lng: -122.3981969390652 } - ], + { lat: 37.7916358762409, lng: -122.3981969390652 }, + ], strokeColor: 'blue', outerColor: 'white', strokeWidth: 10, outerWidth: 0.4, altitudeMode: AltitudeMode.RELATIVE_TO_GROUND, // Place it on the ground (as it has no altitude it will just be at ground height). drawsOccludedSegments: true, // Show the line through the buildings or anything else that might get in the way. - }); + }) polyline.addEventListener('gmp-click', (event) => { // Toggle whether the line draws occluded segments. - event.target.drawsOccludedSegments = !event.target.drawsOccludedSegments; - }); + event.target.drawsOccludedSegments = !event.target.drawsOccludedSegments + }) - map.append(polyline); + map.append(polyline) } -init(); +init() // [END maps_3d_polyline_click_event] diff --git a/samples/3d-polyline-click-event/style.css b/samples/3d-polyline-click-event/style.css index f64defcf..92a3fb4e 100644 --- a/samples/3d-polyline-click-event/style.css +++ b/samples/3d-polyline-click-event/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_polyline_click_event] */ diff --git a/samples/3d-polyline-extruded/index.html b/samples/3d-polyline-extruded/index.html index 0004b5b2..a5eac517 100644 --- a/samples/3d-polyline-extruded/index.html +++ b/samples/3d-polyline-extruded/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-polyline-extruded/index.ts b/samples/3d-polyline-extruded/index.ts index 72cdd184..cc913498 100644 --- a/samples/3d-polyline-extruded/index.ts +++ b/samples/3d-polyline-extruded/index.ts @@ -1,21 +1,25 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_polyline_extruded] -let map; +let map async function init() { - const { Map3DElement, MapMode, AltitudeMode, Polyline3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, MapMode, AltitudeMode, Polyline3DElement } = + await google.maps.importLibrary('maps3d') map = new Map3DElement({ - center: { lat: 37.7927, lng: -122.4020, altitude: 65.93 }, range: 3362.87, tilt: 64.01, heading: 25.00, + center: { lat: 37.7927, lng: -122.402, altitude: 65.93 }, + range: 3362.87, + tilt: 64.01, + heading: 25.0, mode: MapMode.SATELLITE, - }); + }) - document.body.append(map); + document.body.append(map) const polyline = new Polyline3DElement({ path: [ @@ -29,16 +33,16 @@ async function init() { { lat: 37.78861484290265, lng: -122.4019489189814, altitude: 100 }, { lat: 37.78618687561075, lng: -122.398969592545, altitude: 100 }, { lat: 37.7892310309145, lng: -122.3951458683092, altitude: 100 }, - { lat: 37.7916358762409, lng: -122.3981969390652, altitude: 100 } + { lat: 37.7916358762409, lng: -122.3981969390652, altitude: 100 }, ], strokeColor: '#0000FF80', strokeWidth: 10, altitudeMode: AltitudeMode.RELATIVE_TO_GROUND, // Place it on the ground (as it has no altitude it will just be at ground height). - extruded: true - }); + extruded: true, + }) - map.append(polyline); + map.append(polyline) } -init(); +init() // [END maps_3d_polyline_extruded] diff --git a/samples/3d-polyline-extruded/style.css b/samples/3d-polyline-extruded/style.css index 5b6968df..d3cc2546 100644 --- a/samples/3d-polyline-extruded/style.css +++ b/samples/3d-polyline-extruded/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_polyline_extruded] */ diff --git a/samples/3d-polyline/index.html b/samples/3d-polyline/index.html index 5674d881..5fc5862e 100644 --- a/samples/3d-polyline/index.html +++ b/samples/3d-polyline/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-polyline/index.ts b/samples/3d-polyline/index.ts index af4a9e34..8fbc9622 100644 --- a/samples/3d-polyline/index.ts +++ b/samples/3d-polyline/index.ts @@ -1,21 +1,25 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_polyline] -let map; +let map async function init() { - const { Map3DElement, MapMode, AltitudeMode, Polyline3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, MapMode, AltitudeMode, Polyline3DElement } = + await google.maps.importLibrary('maps3d') - map = new Map3DElement({ - center: { lat: 37.7927, lng : -122.4020, altitude: 65.93 }, range: 3362.87, tilt: 64.01 ,heading: 25.00, + map = new Map3DElement({ + center: { lat: 37.7927, lng: -122.402, altitude: 65.93 }, + range: 3362.87, + tilt: 64.01, + heading: 25.0, mode: MapMode.SATELLITE, - }); + }) - document.body.append(map); + document.body.append(map) const polyline = new Polyline3DElement({ path: [ @@ -29,18 +33,18 @@ async function init() { { lat: 37.78861484290265, lng: -122.4019489189814 }, { lat: 37.78618687561075, lng: -122.398969592545 }, { lat: 37.7892310309145, lng: -122.3951458683092 }, - { lat: 37.7916358762409, lng: -122.3981969390652 } - ], + { lat: 37.7916358762409, lng: -122.3981969390652 }, + ], strokeColor: 'blue', outerColor: 'white', strokeWidth: 10, outerWidth: 0.4, altitudeMode: AltitudeMode.RELATIVE_TO_GROUND, // Place it on the ground (as it has no altitude it will just be at ground height). drawsOccludedSegments: true, // Show the line through the buildings or anything else that might get in the way. - }); + }) - map.append(polyline); + map.append(polyline) } -init(); +init() // [END maps_3d_polyline] diff --git a/samples/3d-polyline/style.css b/samples/3d-polyline/style.css index cd5e3276..47f5a48f 100644 --- a/samples/3d-polyline/style.css +++ b/samples/3d-polyline/style.css @@ -9,11 +9,11 @@ */ html, map { - height: 100%; + height: 100%; } body { - height: 100%; - margin: 0; - padding: 0; + height: 100%; + margin: 0; + padding: 0; } /* [END maps_3d_polyline] */ diff --git a/samples/3d-popover-location/index.html b/samples/3d-popover-location/index.html index abde9e26..2f8b27f4 100644 --- a/samples/3d-popover-location/index.html +++ b/samples/3d-popover-location/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + - \ No newline at end of file + diff --git a/samples/3d-popover-location/index.ts b/samples/3d-popover-location/index.ts index aa8c8e7b..9b09f4b3 100644 --- a/samples/3d-popover-location/index.ts +++ b/samples/3d-popover-location/index.ts @@ -1,32 +1,35 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_popover_location] async function init() { -const { AltitudeMode, Map3DElement, MapMode, PopoverElement } = await google.maps.importLibrary("maps3d"); + const { AltitudeMode, Map3DElement, MapMode, PopoverElement } = + await google.maps.importLibrary('maps3d') -const map = new Map3DElement({ - center: { lat: 37.8204, lng : -122.4783, altitude: 0.407 }, range: 4000, tilt: 74 ,heading: 38, - mode: MapMode.HYBRID, -}); + const map = new Map3DElement({ + center: { lat: 37.8204, lng: -122.4783, altitude: 0.407 }, + range: 4000, + tilt: 74, + heading: 38, + mode: MapMode.HYBRID, + }) -const popover = new PopoverElement({ - altitudeMode: AltitudeMode.ABSOLUTE, - open: true, - positionAnchor: { lat: 37.819852, lng: -122.478549, altitude: 150 }, -}); + const popover = new PopoverElement({ + altitudeMode: AltitudeMode.ABSOLUTE, + open: true, + positionAnchor: { lat: 37.819852, lng: -122.478549, altitude: 150 }, + }) -popover.append('Golden Gate Bridge'); + popover.append('Golden Gate Bridge') -map.append(popover); - -document.body.append(map); + map.append(popover) + document.body.append(map) } -init(); +init() // [END maps_3d_popover_location] diff --git a/samples/3d-popover-location/style.css b/samples/3d-popover-location/style.css index 0e4ebafb..894fb328 100644 --- a/samples/3d-popover-location/style.css +++ b/samples/3d-popover-location/style.css @@ -14,6 +14,6 @@ body { padding: 0; } map { - height: 100%; + height: 100%; } /* [END maps_3d_popover_location] */ diff --git a/samples/3d-popover-marker/index.html b/samples/3d-popover-marker/index.html index 653e3f0a..6e94f07d 100644 --- a/samples/3d-popover-marker/index.html +++ b/samples/3d-popover-marker/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + - \ No newline at end of file + diff --git a/samples/3d-popover-marker/index.ts b/samples/3d-popover-marker/index.ts index 18ef6383..e59b81c0 100644 --- a/samples/3d-popover-marker/index.ts +++ b/samples/3d-popover-marker/index.ts @@ -1,43 +1,51 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_popover_marker] async function init() { - const { AltitudeMode, Map3DElement, Marker3DInteractiveElement, MapMode, PopoverElement } = await google.maps.importLibrary("maps3d"); + const { + AltitudeMode, + Map3DElement, + Marker3DInteractiveElement, + MapMode, + PopoverElement, + } = await google.maps.importLibrary('maps3d') const map = new Map3DElement({ - center: { lat: 37.8204, lng: -122.4783, altitude: 0.407 }, range: 4000, tilt: 74, heading: 38, + center: { lat: 37.8204, lng: -122.4783, altitude: 0.407 }, + range: 4000, + tilt: 74, + heading: 38, mode: MapMode.HYBRID, - }); + }) // Popovers can only be added to interactive Markers const interactiveMarker = new Marker3DInteractiveElement({ altitudeMode: AltitudeMode.ABSOLUTE, - position: { lat: 37.819852, lng: -122.478549, altitude: 100 } - }); + position: { lat: 37.819852, lng: -122.478549, altitude: 100 }, + }) const popover = new PopoverElement({ open: false, positionAnchor: interactiveMarker, - }); + }) - popover.append('Golden Gate Bridge'); + popover.append('Golden Gate Bridge') interactiveMarker.addEventListener('gmp-click', (event) => { // toggle the marker to the other state (unlee you are clicking on the marker itself when it reopens it) - popover.open = !popover.open; - }); + popover.open = !popover.open + }) - map.append(interactiveMarker); - map.append(popover); - - document.body.append(map); + map.append(interactiveMarker) + map.append(popover) + document.body.append(map) } -init(); +init() // [END maps_3d_popover_marker] diff --git a/samples/3d-popover-marker/style.css b/samples/3d-popover-marker/style.css index 18fccad3..59461c24 100644 --- a/samples/3d-popover-marker/style.css +++ b/samples/3d-popover-marker/style.css @@ -9,7 +9,7 @@ */ html, map { - height: 100%; + height: 100%; } body { height: 100%; diff --git a/samples/3d-simple-map-declarative/index.html b/samples/3d-simple-map-declarative/index.html index bf89cc27..528f2077 100644 --- a/samples/3d-simple-map-declarative/index.html +++ b/samples/3d-simple-map-declarative/index.html @@ -6,15 +6,21 @@ --> - - Map - - - - + + Map + + + + - - + + diff --git a/samples/3d-simple-map-declarative/index.ts b/samples/3d-simple-map-declarative/index.ts index ce09c184..aa62c7ce 100644 --- a/samples/3d-simple-map-declarative/index.ts +++ b/samples/3d-simple-map-declarative/index.ts @@ -1,8 +1,8 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ // @ts-nocheck // [START maps_3d_simple_map_declarative] diff --git a/samples/3d-simple-map/index.html b/samples/3d-simple-map/index.html index ace75ec5..1c9e371b 100644 --- a/samples/3d-simple-map/index.html +++ b/samples/3d-simple-map/index.html @@ -6,17 +6,16 @@ --> - - Simple Map + + Simple Map - - - - - - - + + + + - + diff --git a/samples/3d-simple-map/index.ts b/samples/3d-simple-map/index.ts index d968476d..3e4ed8ca 100644 --- a/samples/3d-simple-map/index.ts +++ b/samples/3d-simple-map/index.ts @@ -1,22 +1,22 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ //@ts-nocheck // [START maps_3d_simple_map] async function initMap() { - const { Map3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement } = await google.maps.importLibrary('maps3d') const map = new Map3DElement({ center: { lat: 37.7704, lng: -122.3985, altitude: 500 }, tilt: 67.5, - mode: 'HYBRID' - }); + mode: 'HYBRID', + }) - document.body.append(map); + document.body.append(map) } -initMap(); +initMap() // [END maps_3d_simple_map] diff --git a/samples/3d-simple-map/style.css b/samples/3d-simple-map/style.css index 7624a816..db29d516 100644 --- a/samples/3d-simple-map/style.css +++ b/samples/3d-simple-map/style.css @@ -8,7 +8,7 @@ * that contains the map. */ #gmp-map-3d { - height: 100%; + height: 100%; } html, body { diff --git a/samples/3d-simple-marker/index.html b/samples/3d-simple-marker/index.html index f57f3e23..b082ff87 100644 --- a/samples/3d-simple-marker/index.html +++ b/samples/3d-simple-marker/index.html @@ -6,18 +6,18 @@ --> - - Map + + Map - - - - -
+ + + + +
- - - + diff --git a/samples/3d-simple-marker/index.ts b/samples/3d-simple-marker/index.ts index ed01fe1e..2ad6f500 100644 --- a/samples/3d-simple-marker/index.ts +++ b/samples/3d-simple-marker/index.ts @@ -1,31 +1,32 @@ /* -* @license -* Copyright 2025 Google LLC. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0 -*/ + * @license + * Copyright 2025 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ //@ts-nocheck // [START maps_3d_simple_marker] async function init() { // Make sure the Marker3DElement is included. - const { Map3DElement, Marker3DElement } = await google.maps.importLibrary("maps3d"); + const { Map3DElement, Marker3DElement } = + await google.maps.importLibrary('maps3d') const map = new Map3DElement({ center: { lat: 37.4239163, lng: -122.0947209, altitude: 0 }, tilt: 67.5, range: 1000, - mode: 'SATELLITE' - }); - + mode: 'SATELLITE', + }) + const marker = new Marker3DElement({ position: { lat: 37.4239163, lng: -122.0947209, altitude: 50 }, // (Required) Marker must have a lat / lng, but doesn't need an altitude. - altitudeMode : "ABSOLUTE", // (Optional) Treated as CLAMP_TO_GROUND if omitted. - extruded : true, // (Optional) Draws line from ground to the bottom of the marker. - label : "Basic Marker" // (Optional) Add a label to the marker. - }); + altitudeMode: 'ABSOLUTE', // (Optional) Treated as CLAMP_TO_GROUND if omitted. + extruded: true, // (Optional) Draws line from ground to the bottom of the marker. + label: 'Basic Marker', // (Optional) Add a label to the marker. + }) - map.append(marker); // The marker must be appended to the map. - document.body.append(map); + map.append(marker) // The marker must be appended to the map. + document.body.append(map) } -init(); +init() // [END maps_3d_simple_marker] diff --git a/samples/add-map/index.html b/samples/add-map/index.html index d7835b23..f2ab99c9 100644 --- a/samples/add-map/index.html +++ b/samples/add-map/index.html @@ -4,24 +4,24 @@ Copyright 2025 Google LLC. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 --> - + - - Add a Map + + Add a Map - - - - - -

My Google Maps Demo

- - -
- - - + + + +

My Google Maps Demo

+ + +
+ + + - + - \ No newline at end of file + diff --git a/samples/add-map/index.ts b/samples/add-map/index.ts index 5549814c..22a4a0db 100644 --- a/samples/add-map/index.ts +++ b/samples/add-map/index.ts @@ -6,30 +6,32 @@ // [START maps_add_map] // Initialize and add the map. -let map; +let map async function initMap(): Promise { - // [START maps_add_map_instantiate_map] - // The location of Uluru, Australia. - const position = {lat: -25.344, lng: 131.031}; + // [START maps_add_map_instantiate_map] + // The location of Uluru, Australia. + const position = { lat: -25.344, lng: 131.031 } - // Request the needed libraries. - const {Map} = - await google.maps.importLibrary('maps') as google.maps.MapsLibrary; - const {AdvancedMarkerElement} = - await google.maps.importLibrary('marker') as google.maps.MarkerLibrary; + // Request the needed libraries. + const { Map } = (await google.maps.importLibrary( + 'maps' + )) as google.maps.MapsLibrary + const { AdvancedMarkerElement } = (await google.maps.importLibrary( + 'marker' + )) as google.maps.MarkerLibrary - // The map, centered at Uluru, Australia. - map = new Map(document.getElementById('map') as HTMLElement, { - zoom: 4, - center: position, - mapId: 'DEMO_MAP_ID', - }); - // [END maps_add_map_instantiate_map] + // The map, centered at Uluru, Australia. + map = new Map(document.getElementById('map') as HTMLElement, { + zoom: 4, + center: position, + mapId: 'DEMO_MAP_ID', + }) + // [END maps_add_map_instantiate_map] - // [START maps_add_map_instantiate_marker] - // The marker, positioned at Uluru. - const marker = new AdvancedMarkerElement({map, position, title: 'Uluru'}); - // [END maps_add_map_instantiate_marker] + // [START maps_add_map_instantiate_marker] + // The marker, positioned at Uluru. + const marker = new AdvancedMarkerElement({ map, position, title: 'Uluru' }) + // [END maps_add_map_instantiate_marker] } -initMap(); +initMap() // [END maps_add_map] diff --git a/samples/add-map/style.css b/samples/add-map/style.css index 561a4b33..313e5966 100644 --- a/samples/add-map/style.css +++ b/samples/add-map/style.css @@ -4,22 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ /* [START maps_add_map] */ - /* +/* * Always set the map height explicitly to define the size of the div element * that contains the map. */ - #map { +#map { height: 100%; - } - - /* +} + +/* * Optional: Makes the sample page fill the window. */ - html, - body { +html, +body { height: 100%; margin: 0; padding: 0; - } - /* [END maps_add_map] */ - \ No newline at end of file +} +/* [END maps_add_map] */ diff --git a/samples/address-validation/index.html b/samples/address-validation/index.html index 366386db..eb30e123 100644 --- a/samples/address-validation/index.html +++ b/samples/address-validation/index.html @@ -4,132 +4,186 @@ Copyright 2025 Google LLC. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 --> - + - - Address Validation + + Address Validation - - - - - -