mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
Update script.js
175 fix1
This commit is contained in:
parent
d1124c600b
commit
306a0628dc
1 changed files with 19 additions and 19 deletions
38
script.js
38
script.js
|
|
@ -3154,26 +3154,26 @@ function fantasyMap() {
|
|||
function completeNewRoute() {
|
||||
$("#routeNew, #addRoute").removeClass('pressed');
|
||||
restoreDefaultEvents();
|
||||
if (!elSelected.size()) return;
|
||||
if (elSelected.attr("data-route") === "new") {
|
||||
routeRedraw();
|
||||
elSelected.attr("data-route", "");
|
||||
const node = elSelected.node();
|
||||
const l = node.getTotalLength();
|
||||
let pathCells = [];
|
||||
for (let i = 0; i <= l; i ++) {
|
||||
const p = node.getPointAtLength(i);
|
||||
const cell = diagram.find(p.x, p.y);
|
||||
if (!cell) {return;}
|
||||
pathCells.push(cell.index);
|
||||
}
|
||||
const uniqueCells = [...new Set(pathCells)];
|
||||
uniqueCells.map(function(c) {
|
||||
if (cells[c].path !== undefined) {cells[c].path += 1;}
|
||||
else {cells[c].path = 1;}
|
||||
});
|
||||
}
|
||||
tip("", true);
|
||||
|
||||
const newRoute = d3.select("#routes [data-route='new']");
|
||||
if (!newRoute.size()) return;
|
||||
|
||||
if (elSelected && elSelected.attr("id") === newRoute.attr("id")) routeRedraw();
|
||||
newRoute.attr("data-route", "");
|
||||
const node = newRoute.node();
|
||||
const l = node.getTotalLength();
|
||||
let pathCells = [];
|
||||
for (let i = 0; i <= l; i ++) {
|
||||
const p = node.getPointAtLength(i);
|
||||
const cell = find(p.x, p.y);
|
||||
pathCells.push(cell);
|
||||
}
|
||||
const uniqueCells = [...new Set(pathCells)];
|
||||
uniqueCells.map(function(c) {
|
||||
if (cells[c].path !== undefined) {cells[c].path += 1;}
|
||||
else {cells[c].path = 1;}
|
||||
});
|
||||
}
|
||||
|
||||
function routeUpdateGroups() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue