Skip to content

Commit

Permalink
worldmap size 100 and resize on refresh/widget resize
Browse files Browse the repository at this point in the history
  • Loading branch information
murrant committed May 22, 2024
1 parent a7a0072 commit 1bd8e10
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions resources/views/widgets/worldmap.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="leaflet-map-{{ $id }}"
style="width: {{ $dimensions['x'] }}px; height: {{ $dimensions['y'] }}px;"
style="width: 100%; height: 100%;"
data-reload="false"
></div>

Expand Down Expand Up @@ -38,7 +38,7 @@ className: color + newClass,
}
}
function populate_markers() {
function populate_markers(map) {
$.ajax({
type: "GET",
url: '{{ route('widget.worldmap.data') }}',
Expand Down Expand Up @@ -79,7 +79,6 @@ function populate_markers() {
return marker;
});
var map = get_map(map_id);
map.markerCluster.clearLayers();
map.markerCluster.addLayers(markers);
},
Expand All @@ -90,7 +89,9 @@ function populate_markers() {
}
$('#leaflet-map-{{ $id }}').on('refresh', function (event) {
populate_markers();
var map = get_map(map_id);
map.invalidateSize();
populate_markers(map);
})
$('#leaflet-map-{{ $id }}').on('destroy', function (event) {
destroy_map(map_id);
Expand All @@ -102,7 +103,7 @@ function populate_markers() {
loadjs('js/L.Control.Locate.min.js', function () {
var map = init_map(map_id, map_config);
init_marker_cluster(map);
populate_markers();
populate_markers(map);
map.scrollWheelZoom.disable();
$("#leaflet-map-{{ $id }}").on("click", function (event) {
Expand Down

0 comments on commit 1bd8e10

Please sign in to comment.