Skip to content

Commit

Permalink
Loading icon added
Browse files Browse the repository at this point in the history
as 'Loading Icon #3' issue menttions i added a loading icon.
  • Loading branch information
gorkemkurban committed Nov 17, 2024
1 parent 00205e4 commit 8de2f2a
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Apps/3DHeritageMapApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
</head>

<body>
<!-- Loading Icon -->
<div id="loadingScreen">
<div class="spinner"></div>
<p>Loading...</p>
</div>


<!-- Options box -->
<div id="optionsBox">
<h2>Options</h2>
Expand Down
17 changes: 17 additions & 0 deletions Apps/3DHeritageScripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,20 @@ document.getElementById('openOptionsBox').onclick = () => {
document.getElementById('optionsBox').style.display = 'block';
document.getElementById('openOptionsBox').style.display = 'none';
};


// Loading icon element
const loadingScreen = document.getElementById('loadingScreen');

// Hide loading icon after the map uploaded
viewer.scene.globe.tileLoadProgressEvent.addEventListener((count) => {
if (count === 0) {
console.log('Tüm veriler yüklendi');
loadingScreen.style.display = 'none'; // Hide
}
});

// Show loading icon while the page is loading
window.addEventListener('load', () => {
loadingScreen.style.display = 'flex';
});
35 changes: 35 additions & 0 deletions Apps/3DHeritageStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,38 @@
border: 2px;
border-color: white;
}


/* Loading icon styles */
#loadingScreen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
color: white;
font-family: Arial, sans-serif;
}

.spinner {
border: 4px solid rgba(255, 255, 255, 0.3);
border-top: 4px solid white;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

0 comments on commit 8de2f2a

Please sign in to comment.