select template correctly

This commit is contained in:
Azgaar 2022-02-23 22:14:25 +03:00
parent 395a7c28a9
commit c2ceb227ad
2 changed files with 3 additions and 3 deletions

View file

@ -9,7 +9,8 @@ window.HeightmapGenerator = (function () {
cells.h = new Uint8Array(grid.points.length); cells.h = new Uint8Array(grid.points.length);
const input = document.getElementById("templateInput"); const input = document.getElementById("templateInput");
const type = input.querySelector(`[value=${input.value}]`).parentElement.label; const selectedId = input.selectedIndex >= 0 ? input.selectedIndex : 0;
const type = input.options[selectedId]?.parentElement?.label;
if (type === "Specific") { if (type === "Specific") {
// pre-defined heightmap // pre-defined heightmap

View file

@ -536,10 +536,9 @@ class Planimeter extends Measurer {
} }
// Scale bar // Scale bar
function drawScaleBar(requestedScale) { function drawScaleBar(scaleLevel = scale) {
if (scaleBar.style("display") === "none") return; // no need to re-draw hidden element if (scaleBar.style("display") === "none") return; // no need to re-draw hidden element
scaleBar.selectAll("*").remove(); // fully redraw every time scaleBar.selectAll("*").remove(); // fully redraw every time
const scaleLevel = requestedScale || scale;
const distanceScale = distanceScaleInput.value; const distanceScale = distanceScaleInput.value;
const unit = distanceUnitInput.value; const unit = distanceUnitInput.value;