Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
amuramoto authored Jul 13, 2023
2 parents 3706d68 + c8850f3 commit 0f28062
Show file tree
Hide file tree
Showing 24 changed files with 11,287 additions and 1,614 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/e2e.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ jobs:
with:
semantic_version: 19
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/commit-analyzer@^9
semantic-release-interval
@semantic-release/release-notes-generator@10.0.3
@semantic-release/release-notes-generator@^10
@semantic-release/git
@semantic-release/github
@semantic-release/npm@9.0.2
@semantic-release/github@^8
@semantic-release/npm@^9
@googlemaps/semantic-release-config
semantic-release-npm-deprecate
env:
GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
NPM_TOKEN: ${{ secrets.NPM_WOMBAT_TOKEN }}
RUNNER_DEBUG: 1
Empty file removed e2e/README.md
Empty file.
16 changes: 5 additions & 11 deletions examples/algorithms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import {
NoopAlgorithm,
SuperClusterAlgorithm,
} from "../src";
import { getLoaderOptions, sync } from "./config";
import { MAP_ID, createMarker, getLoaderOptions, sync } from "./config";

import { Loader } from "@googlemaps/js-api-loader";
import trees from "./trees.json";

const mapOptions = {
const mapOptions: google.maps.MapOptions = {
center: { lat: 40.7128, lng: -73.85 },
zoom: 10,
mapId: MAP_ID,
};

new Loader(getLoaderOptions()).load().then(() => {
Expand Down Expand Up @@ -62,15 +63,8 @@ new Loader(getLoaderOptions()).load().then(() => {

map.controls[google.maps.ControlPosition.LEFT_TOP].push(textElement);

const markers = trees.map(
({ geometry }) =>
new google.maps.Marker({
position: {
lat: geometry.coordinates[1],
lng: geometry.coordinates[0],
},
map,
})
const markers = trees.map(({ geometry }) =>
createMarker(map, geometry.coordinates[1], geometry.coordinates[0])
);

new MarkerClusterer({
Expand Down
34 changes: 34 additions & 0 deletions examples/bench-advanced.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<!--
Copyright 2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<html>
<head>
<style>
html,
body,
#map {
margin: 0;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="bench-advanced.js" type="module"></script>
<script src="vendor.js" type="module"></script>
</body>
</html>
50 changes: 50 additions & 0 deletions examples/bench-advanced.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { MAP_ID, getLoaderOptions } from "./config";
import { Loader } from "@googlemaps/js-api-loader";
import { MarkerClusterer } from "../src";
import points from "./realworld.json";

// Do not set the mapId to force legacy markers
const mapOptions: google.maps.MapOptions = {
center: { lat: -37.89, lng: 175.46 },
zoom: 8,
maxZoom: 18,
mapId: MAP_ID,
};

new Loader(getLoaderOptions()).load().then(() => {
const element = document.getElementById("map");

const map = new google.maps.Map(element, mapOptions);

const markers = (points as [number, number, string][]).map(
([lat, lng, title]) =>
new google.maps.marker.AdvancedMarkerElement({
position: { lat, lng },
map,
title,
})
);

const markerCluster = new MarkerClusterer({
markers,
algorithmOptions: { maxZoom: 30 },
});

markerCluster.setMap(map);
});
42 changes: 42 additions & 0 deletions examples/bench-leaflet.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<!--
Copyright 2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<html>
<head>
<style>
html,
body,
#map {
margin: 0;
height: 100%;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/MarkerCluster.Default.css"/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js"></script>
</head>
<body>
<div id="map"></div>
<script src="bench-leaflet.js" type="module"></script>
<script src="vendor.js" type="module"></script>
</body>
</html>
44 changes: 44 additions & 0 deletions examples/bench-leaflet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import points from "./realworld.json";

declare let L: any;

const tiles = L.tileLayer("//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution:
'&copy; <a href="//openstreetmap.org/copyright">OpenStreetMap</a> contributors, Points &copy 2012 LINZ',
});

const map = L.map("map", {
center: L.latLng(-37.89, 175.46),
zoom: 8,
layers: [tiles],
});

const mcg = L.markerClusterGroup({
chunkedLoading: true,
spiderfyOnMaxZoom: false,
});

for (const [lat, lng, title] of points as [number, number, string][]) {
const marker = L.marker(new L.LatLng(lat, lng), { title });
marker.bindPopup(title);
mcg.addLayer(marker);
}

map.addLayer(mcg);
34 changes: 34 additions & 0 deletions examples/bench-legacy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<!--
Copyright 2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<html>
<head>
<style>
html,
body,
#map {
margin: 0;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="bench-legacy.js" type="module"></script>
<script src="vendor.js" type="module"></script>
</body>
</html>
45 changes: 45 additions & 0 deletions examples/bench-legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { getLoaderOptions } from "./config";
import { Loader } from "@googlemaps/js-api-loader";
import { MarkerClusterer } from "../src";
import points from "./realworld.json";

// Do not set the mapId to force legacy markers
const mapOptions: google.maps.MapOptions = {
center: { lat: -37.89, lng: 175.46 },
zoom: 8,
maxZoom: 18,
};

new Loader(getLoaderOptions()).load().then(() => {
const element = document.getElementById("map");

const map = new google.maps.Map(element, mapOptions);

const markers = (points as [number, number, string][]).map(
([lat, lng, label]) =>
new google.maps.Marker({ position: { lat, lng }, label })
);

const markerCluster = new MarkerClusterer({
markers,
algorithmOptions: { maxZoom: 30 },
});

markerCluster.setMap(map);
});
Loading

0 comments on commit 0f28062

Please sign in to comment.