Skip to content

Commit 1b981a8

Browse files
Update dist folder [skip ci] (#1137)
1 parent 7ea0182 commit 1b981a8

21 files changed

Lines changed: 382 additions & 0 deletions

dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ <h1>Maps JSAPI Samples</h1>
5555
<li><a href='/samples/boundaries-simple/dist'>boundaries-simple</a></li>
5656
<li><a href='/samples/boundaries-text-search/dist'>boundaries-text-search</a></li>
5757
<li><a href='/samples/circle-simple/dist'>circle-simple</a></li>
58+
<li><a href='/samples/control-bounds-restriction/dist'>control-bounds-restriction</a></li>
5859
<li><a href='/samples/control-custom-state/dist'>control-custom-state</a></li>
5960
<li><a href='/samples/control-disableUI/dist'>control-disableUI</a></li>
6061
<li><a href='/samples/control-options/dist'>control-options</a></li>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": [
3+
"plugin:@typescript-eslint/recommended"
4+
],
5+
"parser": "@typescript-eslint/parser",
6+
"rules": {
7+
"@typescript-eslint/ban-ts-comment": 0,
8+
"@typescript-eslint/no-this-alias": 1,
9+
"@typescript-eslint/no-empty-function": 1,
10+
"@typescript-eslint/explicit-module-boundary-types": 1,
11+
"@typescript-eslint/no-unused-vars": 1
12+
}
13+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Google Maps JavaScript Sample
2+
3+
## control-bounds-restriction
4+
5+
This sample demonstrates restricting the map to a specific area.
6+
7+
## Setup
8+
9+
### Before starting run:
10+
11+
`npm i`
12+
13+
### Run an example on a local web server
14+
15+
`cd samples/control-bounds-restriction`
16+
`npm start`
17+
18+
### Build an individual example
19+
20+
`cd samples/control-bounds-restriction`
21+
`npm run build`
22+
23+
From 'samples':
24+
25+
`npm run build --workspace=control-bounds-restriction/`
26+
27+
### Build all of the examples.
28+
29+
From 'samples':
30+
31+
`npm run build-all`
32+
33+
### Run lint to check for problems
34+
35+
`cd samples/control-bounds-restriction`
36+
`npx eslint index.ts`
37+
38+
## Feedback
39+
40+
For feedback related to this sample, please open a new issue on
41+
[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues).
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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_control_bounds_restriction] -->
8+
<html>
9+
<head>
10+
<title>Map Bounds Restriction</title>
11+
12+
<link rel="stylesheet" type="text/css" href="./style.css" />
13+
<script type="module" src="./index.js"></script>
14+
<!-- prettier-ignore -->
15+
<script>(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", v: "weekly"});</script>
17+
</head>
18+
<body>
19+
<gmp-map center="-37.06, 174.58" zoom="7"></gmp-map>
20+
</body>
21+
</html>
22+
<!-- [END maps_control_bounds_restriction] -->
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* @license
3+
* Copyright 2026 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
// [START maps_control_bounds_restriction]
8+
let innerMap;
9+
const mapElement = document.querySelector('gmp-map') as google.maps.MapElement;
10+
11+
// [START maps_control_bounds_restriction_region]
12+
const NEW_ZEALAND_BOUNDS = {
13+
north: -34.36,
14+
south: -47.35,
15+
west: 166.28,
16+
east: -175.81,
17+
};
18+
// [END maps_control_bounds_restriction_region]
19+
20+
async function initMap() {
21+
// Import the needed libraries.
22+
(await google.maps.importLibrary('maps')) as google.maps.MapsLibrary;
23+
24+
innerMap = mapElement.innerMap;
25+
// [START maps_control_bounds_restriction_options]
26+
// Restrict the map to the provided bounds.
27+
innerMap.setOptions({
28+
restriction: {
29+
latLngBounds: NEW_ZEALAND_BOUNDS,
30+
strictBounds: false,
31+
}
32+
});
33+
// [END maps_control_bounds_restriction_options]
34+
}
35+
36+
initMap();
37+
// [END maps_control_bounds_restriction]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@js-api-samples/control-bounds-restriction",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "tsc && bash ../jsfiddle.sh control-bounds-restriction && bash ../app.sh control-bounds-restriction && bash ../docs.sh control-bounds-restriction && npm run build:vite --workspace=. && bash ../dist.sh control-bounds-restriction",
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+
"dependencies": {
12+
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @license
3+
* Copyright 2026 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/* [START maps_control_bounds_restriction] */
7+
/*
8+
* Optional: Makes the sample page fill the window.
9+
*/
10+
html,
11+
body {
12+
height: 100%;
13+
margin: 0;
14+
padding: 0;
15+
}
16+
17+
/* [END maps_control_bounds_restriction] */
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"module": "esnext",
4+
"target": "esnext",
5+
"strict": true,
6+
"noImplicitAny": false,
7+
"lib": [
8+
"es2015",
9+
"esnext",
10+
"es6",
11+
"dom",
12+
"dom.iterable"
13+
],
14+
"moduleResolution": "Node",
15+
"jsx": "preserve"
16+
}
17+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
html,body{height:100%;margin:0;padding:0}

dist/samples/control-bounds-restriction/dist/assets/index-9-uv2nux.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)