Correction d'un souci d'affichage de la carte

This commit is contained in:
2021-04-01 13:22:31 +02:00
parent 19798d9cf5
commit a887f6892b
10 changed files with 4714 additions and 110 deletions

View File

@@ -105,58 +105,9 @@
$('input[type=radio][delivery-mode]').click(function() {
$('div[id^="select"]').not($('#select-' + $(this).attr('delivery-mode'))).slideUp();
$('#select-' + $(this).attr('delivery-mode')).slideDown('fast');
initMapCnc();
});
function initMapCnc() {
const LIMITES = {
north: 50.85043724044059,
east: 2.6869845409159923,
south: 50.616717259788544,
west: 1.8122213465336767,
};
var opt = {
center: new google.maps.LatLng($("#map-center-lat-cnc").val(), $("#map-center-lon-cnc").val()),
zoom: 12,
streetViewControl: true,
mapTypeControl: true,
restriction: {
latLngBounds: LIMITES,
strictBounds: false,
}
};
if (document.getElementById('cnc_map'))
DataCnc.map = new google.maps.Map(document.getElementById('cnc_map'), opt);
displayPinsCnc();
}
function displayPinsCnc() {
var arrays = [];
$('#coordinates-cnc').eq(0).find('tr').each((r,row) => arrays.push($(row).find('td,th').map((c,cell) => $(cell).text()).toArray()))
arrays.forEach(function(place) {
var marker = new google.maps.Marker({
title: place[3],
label: place[0],
position: new google.maps.LatLng(place[1], place[2]),
map: DataCnc.map
});
});
}
/*********************************************************/
var DataCnc = {
markers: [],
map: null,
geocoder: null,
bounds: null
};
</script>

View File

@@ -155,6 +155,44 @@
});
}
function initMapCnc() {
const LIMITES = {
north: 50.85043724044059,
east: 2.6869845409159923,
south: 50.616717259788544,
west: 1.8122213465336767,
};
var opt = {
center: new google.maps.LatLng($("#map-center-lat-cnc").val(), $("#map-center-lon-cnc").val()),
zoom: 12,
streetViewControl: true,
mapTypeControl: true,
restriction: {
latLngBounds: LIMITES,
strictBounds: false,
}
};
if (document.getElementById('cnc_map'))
DataCnc.map = new google.maps.Map(document.getElementById('cnc_map'), opt);
displayPinsCnc();
}
function displayPinsCnc() {
var arrays = [];
$('#coordinates-cnc').eq(0).find('tr').each((r,row) => arrays.push($(row).find('td,th').map((c,cell) => $(cell).text()).toArray()))
arrays.forEach(function(place) {
var marker = new google.maps.Marker({
title: place[3],
label: place[0],
position: new google.maps.LatLng(place[1], place[2]),
map: DataCnc.map
});
});
}
/*********************************************************/
@@ -164,6 +202,12 @@
geocoder: null,
bounds: null
};
var DataCnc = {
markers: [],
map: null,
geocoder: null,
bounds: null
};
if (typeof(google) === 'undefined') {
loadScript();