mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
add river on click fix
This commit is contained in:
parent
4902a321ea
commit
d5b2e7ed14
2 changed files with 5 additions and 5 deletions
|
|
@ -312,8 +312,8 @@
|
|||
// if dist2 is big or river is small add extra points at 1/3 and 2/3 of segment
|
||||
const p1x = (x1 * 2 + x2) / 3 + -sinMeander;
|
||||
const p1y = (y1 * 2 + y2) / 3 + cosMeander;
|
||||
const p2x = (x1 + x2 * 2) / 3 + sinMeander;
|
||||
const p2y = (y1 + y2 * 2) / 3 + cosMeander;
|
||||
const p2x = (x1 + x2 * 2) / 3 + sinMeander / 2;
|
||||
const p2y = (y1 + y2 * 2) / 3 - cosMeander / 2;
|
||||
const [p1fl, p2fl] = keepInitialFlux ? [flux1, flux1] : [(flux1 * 2 + flux2) / 3, (flux1 + flux2 * 2) / 3];
|
||||
meandered.push([p1x, p1y, p1fl], [p2x, p2y, p2fl]);
|
||||
} else if (dist2 > 25 || riverCells.length < 6) {
|
||||
|
|
@ -444,5 +444,5 @@
|
|||
return getBasin(parent);
|
||||
};
|
||||
|
||||
return {generate, alterHeights, resolveDepressions, addMeandering, getPath: getRiverPath, specify, getName, getBasin, remove};
|
||||
return {generate, alterHeights, resolveDepressions, addMeandering, getRiverPath, specify, getName, getType, getBasin, remove};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ function addRiverOnClick() {
|
|||
}
|
||||
|
||||
const river = rivers.find(r => r.i === riverId);
|
||||
const widthFactor = river?.widthFactor || (!parent || parent === r ? 1.2 : 1);
|
||||
const widthFactor = river?.widthFactor || (!parent || parent === riverId ? 1.2 : 1);
|
||||
|
||||
const riverMeandered = Rivers.addMeandering(riverCells, 1);
|
||||
lineGen.curve(d3.curveCatmullRom.alpha(0.1));
|
||||
|
|
@ -641,7 +641,7 @@ function addRiverOnClick() {
|
|||
const name = Rivers.getName(mouth);
|
||||
const type = Rivers.getType({i: riverId, length, parent});
|
||||
|
||||
rivers.push({i: riverId, source, mouth, discharge, length, width, widthFactor, sourceWidth, parent, cells: riverCells, basin, name, type});
|
||||
rivers.push({i: riverId, source, mouth, discharge, length, width, widthFactor, sourceWidth: 0, parent, cells: riverCells, basin, name, type});
|
||||
}
|
||||
|
||||
if (d3.event.shiftKey === false) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue