Skip to content

Commit 0ba8d9a

Browse files
authored
feat: Re-creates the 3d-map-45-degree-locked sample on clean branch. (#1405)
* feat: Re-creates the 3d-map-45-degree-locked sample on clean branch. * Change DOCTYPE declaration to lowercase * Remove duplicate importLibrary call for maps3d * Update index.ts * Refactor Google Maps API script loading * Update Google Maps API script in index.html * Update Google Maps API script loading logic For the 30th fuckin time. Please. * Update Google Maps API script initialization Adds correctly formatted thing
1 parent fdf12f2 commit 0ba8d9a

5 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!doctype html>
2+
<!--
3+
@license
4+
Copyright 2026 Google LLC. All Rights Reserved.
5+
SPDX-License-Identifier: Apache-2.0
6+
-->
7+
<!-- [START maps_3d_map_45_degree_locked] -->
8+
<html>
9+
<head>
10+
<title>3d map 45-degree perspective</title>
11+
<link rel="stylesheet" type="text/css" href="./style.css" />
12+
<script type="module" src="./index.js"></script>
13+
<script>
14+
// prettier-ignore
15+
(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
16+
key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8"
17+
});
18+
</script>
19+
</head>
20+
<body>
21+
<gmp-map-3d
22+
id="gmp-map-3d"
23+
center="37.789,-122.401,0"
24+
range="2200"
25+
tilt="45"
26+
heading="188"
27+
min-tilt="0"
28+
max-tilt="45"
29+
mode="satellite">
30+
</gmp-map-3d>
31+
</body>
32+
</html>
33+
<!-- [END maps_3d_map_45_degree_locked] -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* @license
3+
* Copyright 2026 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
// [START maps_3d_map_45_degree_locked]
8+
async function initMap(): Promise<void> {
9+
await google.maps.importLibrary('maps3d');
10+
}
11+
12+
void initMap();
13+
// [END maps_3d_map_45_degree_locked]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "@js-api-samples/3d-map-45-degree-locked",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "bash ../build-single.sh",
6+
"test": "tsc && npm run build:vite --workspace=.",
7+
"start": "tsc && vite build --base './' && vite",
8+
"build:vite": "vite build --base './'",
9+
"preview": "vite preview"
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* @license
3+
* Copyright 2026 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/* [START maps_3d_map_45_degree_locked] */
7+
html,
8+
body {
9+
height: 100%;
10+
margin: 0;
11+
padding: 0;
12+
}
13+
/* [END maps_3d_map_45_degree_locked] */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"rootDir": "."
5+
},
6+
"include": ["./*.ts"]
7+
}

0 commit comments

Comments
 (0)