Runtime map images (texture patterns, peak triangle) added with every style before tiles ask for them; styleimagemissing kept as the fallback (MapLibre 6 skips an image added from it for the requesting tile)
This commit is contained in:
1 parent
f0ff5f390f
commit
cd8444ce2a
2 files changed
+19
-5
No files matched your search
@@ -103,7 +103,7 @@ const NATIONAL_PARK = ["any", ...["nation", "národn", "narodn", "nemzeti", "naz
|
||||
// texture from zoom 13, scrub / dwarf pine its own bushes from 11 (no forest texture: OSM rarely says what kind, and
|
||||
// trees everywhere were too busy).
|
||||
// The pattern images are drawn at runtime (patternImage below, on
|
||||
// MapLibre's styleimagemissing), so there's no sprite sheet to extend and
|
||||
// map.js adds them with every style), so there's no sprite sheet to extend and
|
||||
// they work offline alike.
|
||||
// ponytail: same substring trick as NATIONAL_PARK, a word per language.
|
||||
const STRICT_RESERVE = ["any", ...["rezerv", "reserv", "wilderness", "wildnis", "pamiatk", "památk", "monument", "denkmal"].map((word) => ["in", word, ["coalesce", ["get", "class"], ""]])];
|
||||
@@ -230,6 +230,8 @@ const PATTERNS = {
|
||||
military: { day: "rgba(192, 57, 43, 0.4)", night: "rgba(192, 57, 43, 0.35)" },
|
||||
};
|
||||
|
||||
export const PATTERN_IDS = Object.keys(PATTERNS).flatMap((name) => [`maptool-pattern-${name}`, `maptool-pattern-${name}-night`]);
|
||||
|
||||
// "maptool-pattern-<name>[-night]" → { width, height, data } for
|
||||
// map.addImage, drawn on a canvas at 2× (pixelRatio 2); null for other ids.
|
||||
export function patternImage(id) {
|
||||
|
||||
Reference in new issue
Block a user