Skip to content

Commit ba28f46

Browse files
committed
feat: Refactors the 3d-camera-boundary sample to latest standards.
1 parent 839bd78 commit ba28f46

4 files changed

Lines changed: 20 additions & 24 deletions

File tree

samples/3d-camera-boundary/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!doctype html>
22
<!--
33
@license
4-
Copyright 2025 Google LLC. All Rights Reserved.
4+
Copyright 2026 Google LLC. All Rights Reserved.
55
SPDX-License-Identifier: Apache-2.0
66
-->
77
<!-- [START maps_3d_camera_boundary] -->
@@ -19,7 +19,13 @@
1919
</script>
2020
</head>
2121
<body>
22-
<div id="map"></div>
22+
<gmp-map-3d
23+
id="gmp-map-3d"
24+
center="-47.1375,169.5235,150000"
25+
tilt="67.5"
26+
mode="hybrid"
27+
gesture-handling="cooperative">
28+
</gmp-map-3d>
2329
</body>
2430
</html>
2531
<!-- [END maps_3d_camera_boundary] -->

samples/3d-camera-boundary/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/*
22
* @license
3-
* Copyright 2025 Google LLC. All Rights Reserved.
3+
* Copyright 2026 Google LLC. All Rights Reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

77
// [START maps_3d_camera_boundary]
8-
async function init() {
9-
const { Map3DElement } = await google.maps.importLibrary('maps3d');
8+
async function init(): Promise<void> {
9+
await google.maps.importLibrary('maps3d');
1010

11-
const map = new Map3DElement({
12-
center: { lat: -36.86, lng: 174.76, altitude: 10000 },
13-
tilt: 67.5,
14-
mode: 'HYBRID',
15-
bounds: { south: -48.3, west: 163.56, north: -32.86, east: -180 },
16-
gestureHandling: 'COOPERATIVE',
17-
});
11+
const map3DElement = document.querySelector('gmp-map-3d')!;
1812

19-
document.body.append(map);
13+
// Restrict the position of the camera to the specified bounds.
14+
map3DElement.bounds = {
15+
south: -48.3,
16+
west: 163.56,
17+
north: -32.86,
18+
east: -180,
19+
};
2020
}
2121

2222
void init();

samples/3d-camera-boundary/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@
77
"start": "tsc && vite build --base './' && vite",
88
"build:vite": "vite build --base './'",
99
"preview": "vite preview"
10-
},
11-
"dependencies": {
12-
1310
}
1411
}

samples/3d-camera-boundary/style.css

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
/*
22
* @license
3-
* Copyright 2025 Google LLC. All Rights Reserved.
3+
* Copyright 2026 Google LLC. All Rights Reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
/* [START maps_3d_camera_boundary] */
7-
/*
8-
* Always set the map height explicitly to define the size of the div element
9-
* that contains the map.
10-
*/
117
html,
12-
map {
13-
height: 100%;
14-
}
158
body {
169
height: 100%;
1710
margin: 0;

0 commit comments

Comments
 (0)