Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cityfeel/map/templates/map/emotion_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ <h5 class="modal-title" id="addEmotionModalLabel">Oceń to miejsce</h5>
{% block extra_js %}
<script>
// Initialize Leaflet map (global variable for map.js)
window.map = L.map('map').setView([54.3755425, 18.6088834], 12);
window.map = L.map('map', {
worldCopyJump: true // Automatycznie normalizuje pozycję mapy po okrążeniu Ziemi
}).setView([54.3755425, 18.6088834], 12);

// Add OpenStreetMap tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
Expand Down
14 changes: 10 additions & 4 deletions cityfeel/static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,17 @@ function initFilters() {
// === LOADING LOCATIONS ===
function loadVisibleLocations(force = false) {
const bounds = map.getBounds();

// Normalizuj współrzędne do zakresu -180..180
// (potrzebne gdy mapa okrąża Ziemię i lng przekracza ±180)
const sw = bounds.getSouthWest().wrap();
const ne = bounds.getNorthEast().wrap();

const bbox = [
bounds.getSouthWest().lng,
bounds.getSouthWest().lat,
bounds.getNorthEast().lng,
bounds.getNorthEast().lat
sw.lng,
sw.lat,
ne.lng,
ne.lat
].join(',');

// Sprawdź czy bounds się zmieniły (chyba że force=true)
Expand Down