mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
toggle loading menu
This commit is contained in:
parent
5b6ec0cc2e
commit
9777df9a67
2 changed files with 19 additions and 8 deletions
23
main.js
23
main.js
|
|
@ -192,15 +192,24 @@ if (!location.hostname) {
|
|||
d3.select("#loading-text").transition().duration(1000).style("opacity", 0);
|
||||
d3.select("#init-rose").transition().duration(4000).style("opacity", 0);
|
||||
} else {
|
||||
hideLoading();
|
||||
checkLoadParameters();
|
||||
}
|
||||
|
||||
// remove loading screen
|
||||
d3.select("#loading").transition().duration(4000).style("opacity", 0).remove();
|
||||
d3.select("#initial").transition().duration(4000).attr("opacity", 0).remove();
|
||||
function hideLoading() {
|
||||
d3.select("#loading").transition().duration(4000).style("opacity", 0);
|
||||
d3.select("#initial").transition().duration(4000).attr("opacity", 0);
|
||||
d3.select("#optionsContainer").transition().duration(3000).style("opacity", 1);
|
||||
d3.select("#tooltip").transition().duration(4000).style("opacity", 1);
|
||||
}
|
||||
|
||||
function showLoading() {
|
||||
d3.select("#loading").transition().duration(200).style("opacity", 1);
|
||||
d3.select("#initial").transition().duration(200).attr("opacity", 1);
|
||||
d3.select("#optionsContainer").transition().duration(100).style("opacity", 0);
|
||||
d3.select("#tooltip").transition().duration(200).style("opacity", 0);
|
||||
}
|
||||
|
||||
// decide which map should be loaded or generated on page load
|
||||
function checkLoadParameters() {
|
||||
const url = new URL(window.location.href);
|
||||
|
|
@ -1921,16 +1930,18 @@ function showStatistics() {
|
|||
INFO && console.log(stats);
|
||||
}
|
||||
|
||||
const regenerateMap = debounce(function () {
|
||||
const regenerateMap = debounce(async function () {
|
||||
WARN && console.warn("Generate new random map");
|
||||
showLoading();
|
||||
closeDialogs("#worldConfigurator, #options3d");
|
||||
customization = 0;
|
||||
undraw();
|
||||
resetZoom(1000);
|
||||
generate();
|
||||
undraw();
|
||||
await generate();
|
||||
restoreLayers();
|
||||
if (ThreeD.options.isOn) ThreeD.redraw();
|
||||
if ($("#worldConfigurator").is(":visible")) editWorld();
|
||||
hideLoading();
|
||||
}, 1000);
|
||||
|
||||
// clear the map
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue