mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
hotfix: define color scheme on heightmap edit
This commit is contained in:
parent
e654dbb8a5
commit
8101e75f3d
7 changed files with 37 additions and 36 deletions
|
|
@ -150,6 +150,10 @@ function appendStyleSheet() {
|
|||
}
|
||||
|
||||
function insertHtml() {
|
||||
const heightmapColorSchemeOptions = Object.keys(heightmapColorSchemes)
|
||||
.map(scheme => `<option value="${scheme}">${scheme}</option>`)
|
||||
.join("");
|
||||
|
||||
const heightmapSelectionHtml = /* html */ `<div id="heightmapSelection" class="dialog stable">
|
||||
<div class="heightmap-selection">
|
||||
<section data-tip="Select heightmap template – template provides unique, but similar-looking maps on generation">
|
||||
|
|
@ -174,14 +178,7 @@ function insertHtml() {
|
|||
</div>
|
||||
<div data-tip="Color scheme used for heightmap preview">
|
||||
Color scheme
|
||||
<select id="heightmapSelectionColorScheme">
|
||||
<option value="bright" selected>Bright</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="natural">Natural</option>
|
||||
<option value="green">Green</option>
|
||||
<option value="livid">Livid</option>
|
||||
<option value="monochrome">Monochrome</option>
|
||||
</select>
|
||||
<select id="heightmapSelectionColorScheme">${heightmapColorSchemeOptions}</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -276,8 +273,7 @@ function drawHeights(heights) {
|
|||
const ctx = canvas.getContext("2d");
|
||||
const imageData = ctx.createImageData(graph.cellsX, graph.cellsY);
|
||||
|
||||
const schemeId = byId("heightmapSelectionColorScheme").value;
|
||||
const scheme = getColorScheme(schemeId);
|
||||
const scheme = getColorScheme(byId("heightmapSelectionColorScheme").value);
|
||||
const renderOcean = byId("heightmapSelectionRenderOcean").checked;
|
||||
const getHeight = height => (height < 20 ? (renderOcean ? height : 0) : height);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue