Skip to content

Commit

Permalink
Merge pull request #378 from MTES-MCT/simu_print_issue
Browse files Browse the repository at this point in the history
Fix issue with map display after print
  • Loading branch information
thibault authored Aug 9, 2024
2 parents 76b8d51 + a947616 commit 14c77f6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions envergo/static/js/libs/moulinette_result_maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@
}
});

// Subsequently, when the print page is closed, we must reset the maps to
// it's original size
window.addEventListener("afterprint", function () {
map.invalidateSize();

// Note: in firefox, the "afterprint" event is fired as soon as the
// print preview window opens (go figure). So we have to use this hack
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1663290#c12
window.addEventListener("focus", function () {
map.invalidateSize();
});
});

// Track some events to Matomo
map.on('baselayerchange', function (e) {
let mapType = mapData["type"]; // criterion or regulation
Expand Down

0 comments on commit 14c77f6

Please sign in to comment.