|
|
|
@ -789,27 +789,37 @@
|
|
|
|
const map = L.map(mapRef.current, {
|
|
|
|
const map = L.map(mapRef.current, {
|
|
|
|
center: [20, 0],
|
|
|
|
center: [20, 0],
|
|
|
|
zoom: 2,
|
|
|
|
zoom: 2,
|
|
|
|
minZoom: 1,
|
|
|
|
minZoom: 2,
|
|
|
|
maxZoom: 18,
|
|
|
|
maxZoom: 18,
|
|
|
|
worldCopyJump: true,
|
|
|
|
worldCopyJump: false,
|
|
|
|
zoomControl: true
|
|
|
|
zoomControl: true,
|
|
|
|
|
|
|
|
maxBounds: [[-85, -180], [85, 180]],
|
|
|
|
|
|
|
|
maxBoundsViscosity: 1.0
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Initial tile layer
|
|
|
|
// Initial tile layer
|
|
|
|
tileLayerRef.current = L.tileLayer(MAP_STYLES[mapStyle].url, {
|
|
|
|
tileLayerRef.current = L.tileLayer(MAP_STYLES[mapStyle].url, {
|
|
|
|
attribution: MAP_STYLES[mapStyle].attribution,
|
|
|
|
attribution: MAP_STYLES[mapStyle].attribution,
|
|
|
|
noWrap: false
|
|
|
|
noWrap: true
|
|
|
|
}).addTo(map);
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
|
|
|
|
// Day/night terminator
|
|
|
|
// Day/night terminator with resolution option for smoother rendering
|
|
|
|
terminatorRef.current = L.terminator({
|
|
|
|
terminatorRef.current = L.terminator({
|
|
|
|
fillOpacity: 0.4,
|
|
|
|
resolution: 2,
|
|
|
|
fillColor: '#000010',
|
|
|
|
fillOpacity: 0.35,
|
|
|
|
|
|
|
|
fillColor: '#000020',
|
|
|
|
color: '#ffaa00',
|
|
|
|
color: '#ffaa00',
|
|
|
|
weight: 2,
|
|
|
|
weight: 2,
|
|
|
|
dashArray: '5, 5'
|
|
|
|
dashArray: '5, 5'
|
|
|
|
}).addTo(map);
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Refresh terminator after a short delay to ensure proper rendering
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
if (terminatorRef.current) {
|
|
|
|
|
|
|
|
terminatorRef.current.setTime();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
|
|
|
|
// Update terminator every minute
|
|
|
|
// Update terminator every minute
|
|
|
|
setInterval(() => {
|
|
|
|
setInterval(() => {
|
|
|
|
if (terminatorRef.current) {
|
|
|
|
if (terminatorRef.current) {
|
|
|
|
@ -839,7 +849,7 @@
|
|
|
|
mapInstanceRef.current.removeLayer(tileLayerRef.current);
|
|
|
|
mapInstanceRef.current.removeLayer(tileLayerRef.current);
|
|
|
|
tileLayerRef.current = L.tileLayer(MAP_STYLES[mapStyle].url, {
|
|
|
|
tileLayerRef.current = L.tileLayer(MAP_STYLES[mapStyle].url, {
|
|
|
|
attribution: MAP_STYLES[mapStyle].attribution,
|
|
|
|
attribution: MAP_STYLES[mapStyle].attribution,
|
|
|
|
noWrap: false
|
|
|
|
noWrap: true
|
|
|
|
}).addTo(mapInstanceRef.current);
|
|
|
|
}).addTo(mapInstanceRef.current);
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure terminator is on top
|
|
|
|
// Ensure terminator is on top
|
|
|
|
|