Skip to content
Merged
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
1 change: 1 addition & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h1>Maps JSAPI Samples</h1>
<li><a href='/samples/advanced-markers-html/dist'>advanced-markers-html</a></li>
<li><a href='/samples/advanced-markers-html-simple/dist'>advanced-markers-html-simple</a></li>
<li><a href='/samples/advanced-markers-simple/dist'>advanced-markers-simple</a></li>
<li><a href='/samples/advanced-markers-zoom/dist'>advanced-markers-zoom</a></li>
<li><a href='/samples/deckgl-heatmap/dist'>deckgl-heatmap</a></li>
<li><a href='/samples/deckgl-kml/dist'>deckgl-kml</a></li>
<li><a href='/samples/deckgl-kml-updated/dist'>deckgl-kml-updated</a></li>
Expand Down
13 changes: 13 additions & 0 deletions dist/samples/advanced-markers-zoom/app/.eslintsrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/explicit-module-boundary-types": 1,
"@typescript-eslint/no-unused-vars": 1
}
}
40 changes: 40 additions & 0 deletions dist/samples/advanced-markers-zoom/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Google Maps JavaScript Sample

This sample is generated from @googlemaps/js-samples located at
https://github.com/googlemaps-samples/js-api-samples.

## Setup

### Before starting run:

`npm i`

### Run an example on a local web server

`cd samples/advanced-markers-zoom`
`npm start`

### Build an individual example

`cd samples/advanced-markers-zoom`
`npm run build`

From 'samples':

`npm run build --workspace=advanced-markers-zoom/`

### Build all of the examples.

From 'samples':

`npm run build-all`

### Run lint to check for problems

`cd samples/advanced-markers-zoom`
`npx eslint index.ts`

## Feedback

For feedback related to this sample, please open a new issue on
[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues).
23 changes: 23 additions & 0 deletions dist/samples/advanced-markers-zoom/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_advanced_markers_zoom] -->
<html>
<head>
<title>Advanced Marker Zoom Visibility</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
</head>
<body>
<div id="map"></div>

<!-- prettier-ignore -->
<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))})
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
</body>
</html>
<!-- [END maps_advanced_markers_zoom] -->
58 changes: 58 additions & 0 deletions dist/samples/advanced-markers-zoom/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_advanced_markers_zoom]
async function initMap() {
// Request needed libraries.
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;

const map = new Map(document.getElementById('map') as HTMLElement, {
center: {lat: 37.424563902650114, lng: -122.09512859577026},
zoom: 17,
mapId: '4504f8b37365c3d0',
});

const marker01 = new AdvancedMarkerElement({
map,
position: { lat: 37.4239163, lng: -122.094 },
title: 'This marker is visible at zoom level 15 and higher.'
});

const marker02 = new AdvancedMarkerElement({
map,
position: { lat: 37.4245, lng: -122.096 },
title: 'This marker is visible at zoom level 16 and higher.'
});

const marker03 = new AdvancedMarkerElement({
map,
position: { lat: 37.4249, lng: -122.095 },
title: 'This marker is visible at zoom level 17 and higher.'
});

const marker04 = new AdvancedMarkerElement({
map,
position: { lat: 37.425, lng: -122.0955 },
title: 'This marker is visible at zoom level 18 and higher.'
});
// [START maps_advanced_markers_zoom_listener]
map.addListener('zoom_changed', () => {
const zoom = map.getZoom();
if (zoom) {
// Only show each marker above a certain zoom level.
marker01.map = zoom > 14 ? map : null;
marker02.map = zoom > 15 ? map : null;
marker03.map = zoom > 16 ? map : null;
marker04.map = zoom > 17 ? map : null;
}
});
// [END maps_advanced_markers_zoom_listener]
}

initMap();
// [END maps_advanced_markers_zoom]
14 changes: 14 additions & 0 deletions dist/samples/advanced-markers-zoom/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@js-api-samples/advanced-markers-zoom",
"version": "1.0.0",
"scripts": {
"build": "tsc && bash ../jsfiddle.sh advanced-markers-zoom && bash ../app.sh advanced-markers-zoom && bash ../docs.sh advanced-markers-zoom && npm run build:vite --workspace=. && bash ../dist.sh advanced-markers-zoom",
"test": "tsc && npm run build:vite --workspace=.",
"start": "tsc && vite build --base './' && vite",
"build:vite": "vite build --base './'",
"preview": "vite preview"
},
"dependencies": {

}
}
25 changes: 25 additions & 0 deletions dist/samples/advanced-markers-zoom/app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_advanced_markers_zoom] */
/*
* Always set the map height explicitly to define the size of the div element
* that contains the map.
*/
#map {
height: 100%;
}

/*
* Optional: Makes the sample page fill the window.
*/
html,
body {
height: 100%;
margin: 0;
padding: 0;
}

/* [END maps_advanced_markers_zoom] */
17 changes: 17 additions & 0 deletions dist/samples/advanced-markers-zoom/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"strict": true,
"noImplicitAny": false,
"lib": [
"es2015",
"esnext",
"es6",
"dom",
"dom.iterable"
],
"moduleResolution": "Node",
"jsx": "preserve"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/#map{height:100%}html,body{height:100%;margin:0;padding:0}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions dist/samples/advanced-markers-zoom/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_advanced_markers_zoom] -->
<html>
<head>
<title>Advanced Marker Zoom Visibility</title>

<script type="module" crossorigin src="./assets/index-DqaTsQYt.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-DW_Ml_OD.css">
</head>
<body>
<div id="map"></div>

<!-- prettier-ignore -->
<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))})
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
</body>
</html>
<!-- [END maps_advanced_markers_zoom] -->
23 changes: 23 additions & 0 deletions dist/samples/advanced-markers-zoom/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_advanced_markers_zoom] -->
<html>
<head>
<title>Advanced Marker Zoom Visibility</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
</head>
<body>
<div id="map"></div>

<!-- prettier-ignore -->
<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))})
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
</body>
</html>
<!-- [END maps_advanced_markers_zoom] -->
51 changes: 51 additions & 0 deletions dist/samples/advanced-markers-zoom/docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"use strict";
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_advanced_markers_zoom]
async function initMap() {
// Request needed libraries.
const { Map } = await google.maps.importLibrary("maps");
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker");
const map = new Map(document.getElementById('map'), {
center: { lat: 37.424563902650114, lng: -122.09512859577026 },
zoom: 17,
mapId: '4504f8b37365c3d0',
});
const marker01 = new AdvancedMarkerElement({
map,
position: { lat: 37.4239163, lng: -122.094 },
title: 'This marker is visible at zoom level 15 and higher.'
});
const marker02 = new AdvancedMarkerElement({
map,
position: { lat: 37.4245, lng: -122.096 },
title: 'This marker is visible at zoom level 16 and higher.'
});
const marker03 = new AdvancedMarkerElement({
map,
position: { lat: 37.4249, lng: -122.095 },
title: 'This marker is visible at zoom level 17 and higher.'
});
const marker04 = new AdvancedMarkerElement({
map,
position: { lat: 37.425, lng: -122.0955 },
title: 'This marker is visible at zoom level 18 and higher.'
});
// [START maps_advanced_markers_zoom_listener]
map.addListener('zoom_changed', () => {
const zoom = map.getZoom();
if (zoom) {
// Only show each marker above a certain zoom level.
marker01.map = zoom > 14 ? map : null;
marker02.map = zoom > 15 ? map : null;
marker03.map = zoom > 16 ? map : null;
marker04.map = zoom > 17 ? map : null;
}
});
// [END maps_advanced_markers_zoom_listener]
}
initMap();
// [END maps_advanced_markers_zoom]
58 changes: 58 additions & 0 deletions dist/samples/advanced-markers-zoom/docs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_advanced_markers_zoom]
async function initMap() {
// Request needed libraries.
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;

const map = new Map(document.getElementById('map') as HTMLElement, {
center: {lat: 37.424563902650114, lng: -122.09512859577026},
zoom: 17,
mapId: '4504f8b37365c3d0',
});

const marker01 = new AdvancedMarkerElement({
map,
position: { lat: 37.4239163, lng: -122.094 },
title: 'This marker is visible at zoom level 15 and higher.'
});

const marker02 = new AdvancedMarkerElement({
map,
position: { lat: 37.4245, lng: -122.096 },
title: 'This marker is visible at zoom level 16 and higher.'
});

const marker03 = new AdvancedMarkerElement({
map,
position: { lat: 37.4249, lng: -122.095 },
title: 'This marker is visible at zoom level 17 and higher.'
});

const marker04 = new AdvancedMarkerElement({
map,
position: { lat: 37.425, lng: -122.0955 },
title: 'This marker is visible at zoom level 18 and higher.'
});
// [START maps_advanced_markers_zoom_listener]
map.addListener('zoom_changed', () => {
const zoom = map.getZoom();
if (zoom) {
// Only show each marker above a certain zoom level.
marker01.map = zoom > 14 ? map : null;
marker02.map = zoom > 15 ? map : null;
marker03.map = zoom > 16 ? map : null;
marker04.map = zoom > 17 ? map : null;
}
});
// [END maps_advanced_markers_zoom_listener]
}

initMap();
// [END maps_advanced_markers_zoom]
Loading