hmm?
This commit is contained in:
parent
ea0067dc0a
commit
112e6bf86b
11 changed files with 1586 additions and 1253 deletions
20
renderer.js
20
renderer.js
|
|
@ -893,11 +893,20 @@ export function drawMap(canvas, map, options) {
|
|||
const showFeatures = options.showFeatures !== false;
|
||||
const showLabels = options.showLabels !== false;
|
||||
const continuousTerrain = options.continuousTerrain !== false;
|
||||
const zoom = Math.min(Math.max(Number(options.zoom) || 1, 0.55), 2.8);
|
||||
|
||||
const width = MAP_W * CELL_SIZE;
|
||||
const height = MAP_H * CELL_SIZE;
|
||||
if (canvas.width !== width) canvas.width = width;
|
||||
if (canvas.height !== height) canvas.height = height;
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
ctx.save();
|
||||
ctx.translate(width * (1 - zoom) * 0.5, height * (1 - zoom) * 0.5);
|
||||
ctx.scale(zoom, zoom);
|
||||
const finish = () => {
|
||||
ctx.restore();
|
||||
drawScaleBar(ctx);
|
||||
};
|
||||
|
||||
// 1. Base Terrain & Urban
|
||||
drawBase(ctx, map, mode, continuousTerrain);
|
||||
|
|
@ -992,7 +1001,10 @@ export function drawMap(canvas, map, options) {
|
|||
drawVectorSegments(ctx, finalPrefectureBorders, "rgba(110, 90, 110, 1)", 2.2, true, { iterations: 2, tolerance: 0.06, offsetX: -0.5, offsetY: -0.5 });
|
||||
}
|
||||
|
||||
if (!showFeatures) return;
|
||||
if (!showFeatures) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. Transport casings. Layer order: local roads, trunk roads, railways, expressways.
|
||||
const localRoadCasing = "rgba(112, 112, 104, 0.58)";
|
||||
|
|
@ -1089,12 +1101,12 @@ export function drawMap(canvas, map, options) {
|
|||
.filter((p) => p && p.name)
|
||||
.map((p) => ({ ...p, labelStyle: "municipality", forceLabel: true, labelPriorityBase: 1200 }));
|
||||
drawLabels(ctx, [...prefectureLabels, ...municipalLabels], Infinity);
|
||||
drawScaleBar(ctx);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (mode === "borders-debug") {
|
||||
drawLabels(ctx, prefectureLabels, Infinity);
|
||||
drawScaleBar(ctx);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
const important = [
|
||||
|
|
@ -1106,5 +1118,5 @@ export function drawMap(canvas, map, options) {
|
|||
].filter((p) => !p.suppressSettlementLabel && (p.isPrefectureLabel || p.forceAllLayerTownLabel || p.insidePrefecture || p.isRegionalCapital || p.kind === "External Gateway" || (p.population || 0) >= 5000));
|
||||
drawLabels(ctx, important, mode === "all" || mode === "history" ? 78 : 60);
|
||||
}
|
||||
drawScaleBar(ctx);
|
||||
finish();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue