removed unused css declarations; renamed invalidateSize to resize

This commit is contained in:
Balázs Vigh 2021-05-01 20:28:44 +02:00
parent 2799b19b14
commit aee146ba62
2 changed files with 16 additions and 23 deletions

View File

@ -12,11 +12,6 @@
width: 1em; width: 1em;
height: 1em; height: 1em;
vertical-align: -0.15em; vertical-align: -0.15em;
fill: #ffffff;
}
#mapSelection img svg {
fill: #28a745;
} }
/* modify the cursor for the Leaflet map */ /* modify the cursor for the Leaflet map */

View File

@ -117,7 +117,7 @@
MapEditor.resetSelected(); MapEditor.resetSelected();
MapEditor.selectedMarker = marker; MapEditor.selectedMarker = marker;
MapEditor.map.invalidateSize(true); MapEditor.map.resize();
MapEditor.map.panTo(marker.getLatLng()); MapEditor.map.panTo(marker.getLatLng());
MapEditor.panorama.setVisible(false); MapEditor.panorama.setVisible(false);
@ -219,7 +219,7 @@
MapEditor.resetSelected(del); MapEditor.resetSelected(del);
MapEditor.selectedMarker = null; MapEditor.selectedMarker = null;
MapEditor.map.invalidateSize(true); MapEditor.map.resize();
}, },
deletePlace: function () { deletePlace: function () {
@ -373,7 +373,7 @@
init: function (divId, places) { init: function (divId, places) {
document.getElementById(divId).style.display = "block"; document.getElementById(divId).style.display = "block";
if(!LMapWrapper.map) { if (!LMapWrapper.map) {
LMapWrapper.divId = divId; LMapWrapper.divId = divId;
LMapWrapper.map = L.map(LMapWrapper.divId, { LMapWrapper.map = L.map(LMapWrapper.divId, {
zoomControl: false zoomControl: false
@ -401,12 +401,12 @@
LMapWrapper.loadMarkers(places); LMapWrapper.loadMarkers(places);
}, },
hide: function() { hide: function () {
document.getElementById(LMapWrapper.divId).style.display = 'none'; document.getElementById(LMapWrapper.divId).style.display = 'none';
}, },
loadMarkers: function (places) { loadMarkers: function (places) {
if(!LMapWrapper.markers) { if (!LMapWrapper.markers) {
LMapWrapper.markers = L.markerClusterGroup({ LMapWrapper.markers = L.markerClusterGroup({
maxClusterRadius: 50 maxClusterRadius: 50
}); });
@ -455,8 +455,8 @@
LMapWrapper.map.panTo(latLng); LMapWrapper.map.panTo(latLng);
}, },
invalidateSize: function (invalid) { resize: function () {
LMapWrapper.map.invalidateSize(invalid); LMapWrapper.map.invalidateSize(true);
}, },
changeMarkerIcon: function (marker, icon) { changeMarkerIcon: function (marker, icon) {
@ -497,7 +497,7 @@
init: function (divId, places) { init: function (divId, places) {
document.getElementById(divId).style.display = "block"; document.getElementById(divId).style.display = "block";
if(!GMapWrapper.map) { if (!GMapWrapper.map) {
GMapWrapper.divId = divId; GMapWrapper.divId = divId;
GMapWrapper.map = new google.maps.Map(document.getElementById(GMapWrapper.divId), { GMapWrapper.map = new google.maps.Map(document.getElementById(GMapWrapper.divId), {
center: { lat: 0., lng: 0. }, center: { lat: 0., lng: 0. },
@ -528,12 +528,12 @@
GMapWrapper.loaded = true; GMapWrapper.loaded = true;
}, },
hide: function() { hide: function () {
document.getElementById(GMapWrapper.divId).style.display = 'none'; document.getElementById(GMapWrapper.divId).style.display = 'none';
}, },
loadMarkers: function (places) { loadMarkers: function (places) {
if(!GMapWrapper.markers) { if (!GMapWrapper.markers) {
GMapWrapper.markers = new MarkerClusterer(GMapWrapper.map, [], { GMapWrapper.markers = new MarkerClusterer(GMapWrapper.map, [], {
imagePath: STATIC_ROOT + '/img/markers/m', imagePath: STATIC_ROOT + '/img/markers/m',
imageExtension: 'png?rev' + REVISION imageExtension: 'png?rev' + REVISION
@ -595,10 +595,8 @@
GMapWrapper.map.panTo(latLng); GMapWrapper.map.panTo(latLng);
}, },
invalidateSize: function (invalid) { resize: function () {
if (invalid) {
google.maps.event.trigger(GMapWrapper.map, 'resize'); google.maps.event.trigger(GMapWrapper.map, 'resize');
}
}, },
changeMarkerIcon: function (marker, icon) { changeMarkerIcon: function (marker, icon) {
@ -682,11 +680,11 @@
} }
}; };
document.getElementById('mapSelector').onclick = function() { document.getElementById('mapSelector').onclick = function () {
MapEditor.closePlace(); MapEditor.closePlace();
MapEditor.map.hide(); MapEditor.map.hide();
if(MapEditor.map === GMapWrapper) { if (MapEditor.map === GMapWrapper) {
MapEditor.map = LMapWrapper; MapEditor.map = LMapWrapper;
MapEditor.map.init('lmap', places); MapEditor.map.init('lmap', places);
} else { } else {