new locations array organisation

This commit is contained in:
lenovo
2022-11-05 21:53:00 +01:00
parent 9424cca52e
commit 6fc3c78b71
10 changed files with 144 additions and 73 deletions

View File

@@ -2,9 +2,14 @@ function mp_init_map() {
/*
* following variable are created by mp_add_to_script.php
* - let events = [{}, {}...]
* - let icon_url = ""
* - let icon_cluster_url = ""
* - let locations = [
* {
* coord: {}
* events: [{}, ...]
* },
* ...
* ]
* - let coordinates_default = {lat: ,lng: }
* - let icon_color = ""
* - let icon_size = [x, y]
* - let cluster_size_factor = Number
@@ -15,10 +20,11 @@ function mp_init_map() {
*/
//print_error("error");
console.log("hello");
console.log("locations:");
console.log(locations);
// default map center to france
let map_center = {lat:46.227638, lng:2.213749};
let map_center = coordinates_default;
let map_options = {
/* map options : https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions */
disableDefaultUI: true,
@@ -33,7 +39,6 @@ function mp_init_map() {
//draggable: "true", //deprecated
center: map_center,
}
let svg_icon = window.btoa(`
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<circle cx="50%" cy="50%" r="27%" stroke="#ba197a" stroke-width="26" fill="#ffffff80" />
@@ -44,12 +49,6 @@ function mp_init_map() {
url: `data:image/svg+xml;base64,${svg_icon}`,
scaledSize: new google.maps.Size(icon_size[0], icon_size[1]),
};
let label_options = {
//text: String(count),
text: "?",
//color: icon_label_color,
fontSize: "12px",
};
@@ -59,12 +58,11 @@ function mp_init_map() {
let map = new google.maps.Map(document.getElementById("ljdp_map"), map_options);
let markers = [];
for (ev of events) {
for (loc of locations) {
marker = new google.maps.Marker({
position: ev.coordinates,
position: loc.coordinates,
map: map,
icon: icon_options,
//label: label_options,
});
markers.push(marker);
};