mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
refactor: draw state labels start
This commit is contained in:
parent
e35cc2e9cb
commit
e07bf91cd7
4 changed files with 131 additions and 18 deletions
|
|
@ -69,8 +69,8 @@ async function generate(options?: IGenerationOptions) {
|
|||
// renderLayer("biomes");
|
||||
renderLayer("burgs");
|
||||
renderLayer("routes");
|
||||
// renderLayer("states");
|
||||
renderLayer("provinces");
|
||||
renderLayer("states");
|
||||
renderLayer("labels");
|
||||
|
||||
// pack.cells.route.forEach((route, index) => {
|
||||
// if (route === 2) drawPoint(pack.cells.p[index], {color: "black"});
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ interface IGetPolesProps {
|
|||
export function getPolesOfInaccessibility(props: IGetPolesProps) {
|
||||
TIME && console.time("getPolesOfInaccessibility");
|
||||
const multiPolygons = getMultiPolygons(props);
|
||||
const sortByLength = (a: unknown[], b: unknown[]) => b.length - a.length;
|
||||
console.log(multiPolygons);
|
||||
|
||||
const poles: Dict<TPoint> = Object.fromEntries(
|
||||
Object.entries(multiPolygons).map(([id, multiPolygon]) => {
|
||||
const [x, y] = polylabel(multiPolygon, 20);
|
||||
const [x, y] = polylabel(multiPolygon.sort(sortByLength), 20);
|
||||
return [id, [rn(x), rn(y)]];
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue