修复地图放大之后消失的BUG

This commit is contained in:
CN-JS-HuiBai
2026-04-06 00:15:04 +08:00
parent 97e87409b5
commit d4d2927963
2 changed files with 31 additions and 17 deletions

View File

@@ -1997,6 +1997,8 @@ input:checked+.slider:before {
backdrop-filter: blur(15px); backdrop-filter: blur(15px);
animation: globeExpand 0.4s cubic-bezier(0.16, 1, 0.3, 1); animation: globeExpand 0.4s cubic-bezier(0.16, 1, 0.3, 1);
margin: 0 !important; margin: 0 !important;
display: flex !important; /* Force flex for proper internal layout */
flex-direction: column;
} }
@keyframes globeExpand { @keyframes globeExpand {
@@ -2011,7 +2013,9 @@ input:checked+.slider:before {
} }
.globe-card.expanded .globe-body { .globe-card.expanded .globe-body {
height: calc(100% - 130px) !important; flex: 1; /* Allow map to fill all remaining space */
height: auto !important; /* Override fixed height in expanded state */
min-height: 0;
} }
.chart-header-actions { .chart-header-actions {

View File

@@ -185,10 +185,11 @@
dom.globeCard.classList.toggle('expanded'); dom.globeCard.classList.toggle('expanded');
dom.btnExpandGlobe.classList.toggle('active'); dom.btnExpandGlobe.classList.toggle('active');
if (myMap2D) { if (myMap2D) {
// Multiple resizes to handle animation frames // Multiple resizes to handle animation phases and final layout
setTimeout(() => myMap2D.resize(), 50); myMap2D.resize();
setTimeout(() => myMap2D.resize(), 150); setTimeout(() => myMap2D.resize(), 100);
setTimeout(() => myMap2D.resize(), 400); setTimeout(() => myMap2D.resize(), 300);
setTimeout(() => myMap2D.resize(), 600); // Final resize after animation
} }
}); });
} }
@@ -662,21 +663,30 @@
// Add latency routes if configured // Add latency routes if configured
if (currentLatencies && currentLatencies.length > 0) { if (currentLatencies && currentLatencies.length > 0) {
const countryCoords = { const countryCoords = {
'China': [116.4074, 39.9042], 'china': [116.4074, 39.9042],
'United States': [-95.7129, 37.0902], 'united states': [-95.7129, 37.0902],
'Japan': [138.2529, 36.2048], 'us seattle': [-122.3321, 47.6062],
'Singapore': [103.8198, 1.3521], 'seattle': [-122.3321, 47.6062],
'Germany': [10.4515, 51.1657], 'japan': [138.2529, 36.2048],
'United Kingdom': [-3.436, 55.3781], 'singapore': [103.8198, 1.3521],
'France': [2.2137, 46.2276], 'germany': [10.4515, 51.1657],
'Hong Kong': [114.1694, 22.3193], 'united kingdom': [-3.436, 55.3781],
'Taiwan': [120.9605, 23.6978], 'france': [2.2137, 46.2276],
'Korea': [127.7669, 35.9078] 'hong kong': [114.1694, 22.3193],
'taiwan': [120.9605, 23.6978],
'south korea': [127.7669, 35.9078],
'korea': [127.7669, 35.9078]
}; };
const getCoords = (name) => { const getCoords = (name) => {
if (countryCoords[name]) return countryCoords[name]; const lowerName = (name || '').toLowerCase().trim();
const s = servers.find(sv => sv.countryName === name || sv.country === name); if (countryCoords[lowerName]) return countryCoords[lowerName];
const s = servers.find(sv =>
(sv.countryName || '').toLowerCase() === lowerName ||
(sv.country || '').toLowerCase() === lowerName ||
(sv.city || '').toLowerCase() === lowerName
);
if (s && s.lng && s.lat) return [s.lng, s.lat]; if (s && s.lng && s.lat) return [s.lng, s.lat];
return null; return null;
}; };