NPS-style protected areas and textures: national parks keep the full sage fill, other protected areas a translucent gray-green with a dashed outline, military areas red hatch + outline; forest (z12+) and grass (z13+) textures drawn on canvas and registered on styleimagemissing, with night variants; legend rows
CI / check (push) Successful in 20s
CI / deploy (push) Successful in 18s

This commit is contained in:
randy committed 2026-11-23 19:19:11 +01:00
1 parent 31b27a0852
commit 25f5c42a1b
4 files changed
+132 -6

No files matched your search

+7 -1
View File
@@ -23,7 +23,7 @@ import { getPosition } from "/vendor/suncalc/suncalc.js";
import { notifySidePanelOpen, onlyOneSidePanelOpen, setupSidePanelModes } from "/js/panels.js";
import { isLoggedIn } from "/js/auth.js";
import { DebugControl } from "/js/debug.js";
import { patchOnlineStyle, NightMap } from "/js/map_themes.js";
import { patchOnlineStyle, patternImage, NightMap } from "/js/map_themes.js";
import { offerSharedFiles } from "/js/share_import.js";
import HomeButton from "/vendor/npmap-home-button/home-button.esm.js";
import OverviewMap from "/vendor/npmap-overview/overview.esm.js";
@@ -473,6 +473,12 @@ setInterval(updateSun, 60000);
const NIGHT_MODES = { auto: ["◐", "Night mode: automatic (after sunset)"], on: ["☾", "Night mode: on"], off: ["☀", "Night mode: off"] };
const nightButton = document.querySelector(".topbar__night");
const nightMap = new NightMap(map);
// The base style's texture patterns (forest, grass, military hatch) are
// drawn on demand rather than shipped in a sprite sheet.
map.on("styleimagemissing", ({ id }) => {
const pattern = !map.hasImage(id) && patternImage(id);
if (pattern) map.addImage(id, pattern.image, pattern.options);
});
nightMap.base(initialStyle);
let nightMode = "auto";
try {