地图支持放大

This commit is contained in:
CN-JS-HuiBai
2026-04-06 00:04:13 +08:00
parent dddf9dba65
commit 97e87409b5
3 changed files with 92 additions and 1 deletions

View File

@@ -100,7 +100,9 @@
detailPartitionsContainer: document.getElementById('detailPartitionsContainer'),
detailPartitionsList: document.getElementById('detailPartitionsList'),
partitionSummary: document.getElementById('partitionSummary'),
partitionHeader: document.getElementById('partitionHeader')
partitionHeader: document.getElementById('partitionHeader'),
globeCard: document.getElementById('globeCard'),
btnExpandGlobe: document.getElementById('btnExpandGlobe')
};
// ---- State ----
@@ -177,12 +179,31 @@
dom.btnChangePassword.addEventListener('click', saveChangePassword);
}
// Globe expansion
if (dom.btnExpandGlobe) {
dom.btnExpandGlobe.addEventListener('click', () => {
dom.globeCard.classList.toggle('expanded');
dom.btnExpandGlobe.classList.toggle('active');
if (myMap2D) {
// Multiple resizes to handle animation frames
setTimeout(() => myMap2D.resize(), 50);
setTimeout(() => myMap2D.resize(), 150);
setTimeout(() => myMap2D.resize(), 400);
}
});
}
// Keyboard shortcut
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
closeSettings();
closeLoginModal();
closeServerDetail();
if (dom.globeCard && dom.globeCard.classList.contains('expanded')) {
dom.globeCard.classList.remove('expanded');
dom.btnExpandGlobe.classList.remove('active');
if (myMap2D) setTimeout(() => myMap2D.resize(), 100);
}
}
});