地图支持放大
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user