Skip to content

Commit

Permalink
round river length on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Azgaar committed Jul 28, 2021
1 parent b098865 commit 9604d4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/river-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
const widthFactor = !parent || parent === riverId ? 1.2 : 1;
const meanderedPoints = addMeandering(riverCells);
const discharge = cells.fl[mouth]; // m3 in second
const length = getApproximateLength(meanderedPoints);
const length = rn(getApproximateLength(meanderedPoints), 2);
const width = getWidth(getOffset(discharge, meanderedPoints.length, widthFactor, 0));

pack.rivers.push({i: riverId, source, mouth, discharge, length, width, widthFactor, sourceWidth: 0, parent, cells: riverCells});
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/rivers-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function editRiver(id) {

function updateRiverLength(river) {
river.length = rn(elSelected.node().getTotalLength() / 2, 2);
const length = `${river.length * distanceScaleInput.value} ${distanceUnitInput.value}`;
document.getElementById("riverLength").value = length;
const lengthUI = `${rn(river.length * distanceScaleInput.value)} ${distanceUnitInput.value}`;
document.getElementById("riverLength").value = lengthUI;
}

function updateRiverWidth(river) {
Expand Down

0 comments on commit 9604d4a

Please sign in to comment.