mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
merge synchronizing dynamic modules
This commit is contained in:
parent
9d18e962ac
commit
cf017b4943
6 changed files with 25 additions and 129 deletions
|
|
@ -294,13 +294,13 @@ function statesEditorAddLines() {
|
|||
$body.innerHTML = lines;
|
||||
|
||||
// update footer
|
||||
statesFooterStates.innerHTML = pack.states.filter(s => s.i && !s.removed).length;
|
||||
statesFooterCells.innerHTML = pack.cells.h.filter(h => h >= 20).length;
|
||||
statesFooterBurgs.innerHTML = totalBurgs;
|
||||
statesFooterArea.innerHTML = `${si(totalArea)} ${unit}`;
|
||||
statesFooterPopulation.innerHTML = si(totalPopulation);
|
||||
statesFooterArea.dataset.area = totalArea;
|
||||
statesFooterPopulation.dataset.population = totalPopulation;
|
||||
byId("statesFooterStates").innerHTML = pack.states.filter(s => s.i && !s.removed).length;
|
||||
byId("statesFooterCells").innerHTML = pack.cells.h.filter(h => h >= 20).length;
|
||||
byId("statesFooterBurgs").innerHTML = totalBurgs;
|
||||
byId("statesFooterArea").innerHTML = si(totalArea) + unit;
|
||||
byId("statesFooterArea").dataset.area = totalArea;
|
||||
byId("statesFooterPopulation").innerHTML = si(totalPopulation);
|
||||
byId("statesFooterPopulation").dataset.population = totalPopulation;
|
||||
|
||||
// add listeners
|
||||
$body.querySelectorAll(":scope > div").forEach($line => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
const initialSeed = generateSeed();
|
||||
let graph = getGraph(grid);
|
||||
|
||||
const initialSeed = generateSeed();
|
||||
appendStyleSheet();
|
||||
insertHtml();
|
||||
addListeners();
|
||||
|
|
@ -97,19 +96,6 @@ function appendStyleSheet() {
|
|||
justify-self: end;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.heightmap-selection_container {
|
||||
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
||||
grid-gap: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 2000px) {
|
||||
.heightmap-selection_container {
|
||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.heightmap-selection article {
|
||||
padding: 4px;
|
||||
border-radius: 8px;
|
||||
|
|
@ -322,20 +308,6 @@ async function drawPrecreatedHeightmap(id) {
|
|||
article.querySelector("img").src = dataUrl;
|
||||
}
|
||||
|
||||
function drawTemplatePreview(id) {
|
||||
const heights = HeightmapGenerator.fromTemplate(graph, id);
|
||||
const dataUrl = drawHeights(heights);
|
||||
const article = byId("heightmapSelection").querySelector(`[data-id="${id}"]`);
|
||||
article.querySelector("img").src = dataUrl;
|
||||
}
|
||||
|
||||
async function drawPrecreatedHeightmap(id) {
|
||||
const heights = await HeightmapGenerator.fromPrecreated(graph, id);
|
||||
const dataUrl = drawHeights(heights);
|
||||
const article = byId("heightmapSelection").querySelector(`[data-id="${id}"]`);
|
||||
article.querySelector("img").src = dataUrl;
|
||||
}
|
||||
|
||||
function regeneratePreview(article, id) {
|
||||
graph = getGraph(graph);
|
||||
const seed = generateSeed();
|
||||
|
|
|
|||
|
|
@ -62,18 +62,8 @@ export function open(props) {
|
|||
}
|
||||
|
||||
function appendStyleSheet() {
|
||||
const styles = /* css */ `
|
||||
|
||||
#hierarchyTree {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#hierarchyTree > svg {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = /* css */ `
|
||||
#hierarchyTree_selectedOrigins > button {
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
|
@ -428,6 +418,7 @@ function selectElement(d) {
|
|||
</div>
|
||||
`;
|
||||
});
|
||||
|
||||
byId("hierarchyTree_originSelector").innerHTML = /*html*/ `
|
||||
<form style="max-height: 35vh">
|
||||
${selectableElementsHtml.join("")}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue