42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
|
|
function restrict_map(restrict) {
|
|
let map_restriction = {
|
|
latLngBounds: g_world_bound,
|
|
strictBounds: true,
|
|
};
|
|
if (restrict)
|
|
g_map.setOptions({restriction: map_restriction,});
|
|
else
|
|
g_map.setOptions({restriction: null,});
|
|
};
|
|
|
|
function create_map(map_div) {
|
|
// default map center to france
|
|
let map_center = coordinates_default;
|
|
// map_center = {lat:-2.515748362923059, lng:32.93366215464864};
|
|
let map_restriction = {
|
|
latLngBounds: g_world_bound,
|
|
strictBounds: true,
|
|
};
|
|
let map_options = {
|
|
/* map options : https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions */
|
|
disableDefaultUI: true,
|
|
zoomControl: true,
|
|
scaleControl: true,
|
|
zoom: map_zoom,
|
|
|
|
//gestureHandling: "cooperative",
|
|
gestureHandling: "greedy",
|
|
//gestureHandling: "none",
|
|
//gestureHandling: "auto",
|
|
|
|
//disableDoubleClickZoom: "false", // deprecated
|
|
//draggable: "true", // deprecated
|
|
|
|
center: map_center,
|
|
restriction: map_restriction,
|
|
}
|
|
|
|
return new google.maps.Map(map_div, map_options);
|
|
}
|