Rounded, after the Design canvas' GridRounded: drive mode's cells and keys with 12 px corners on a black ground, the gaps (3 px a side) out of them, the map keeping its area with corners of its own; the map's points one frame, the NPS rounded square — the trip's stops, the search pins, the clusters and the points with no pictogram (badges like the p4n/OsmAnd ones) instead of circles
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-12-04 14:28:32 +01:00
1 parent 87d7bd2463
commit bf90f4cf23
2 files changed
+44 -17

No files matched your search

+18 -15
View File
@@ -28,6 +28,9 @@ const POI_ICON_KEYS = Object.keys(POI_ICONS);
const POI_ICON_IMAGE_SIZE = 48; // rasterized once at this size, rendered much smaller by icon-size below
const POI_ICON_SIZE = 0.3; // 48 * 0.3 = ~14px, sized to sit inside the marker badge below
const MAP_MARKER_SIZE = 0.55;
// The clusters as the same rounded-square badge, light -> dark by count
// (16 / 20 / 26 px "radius" before, now that half the side).
const CLUSTER_COLORS = ["#a8c8ea", "#5b9bd5", "#2e6da4"];
const BADGE_IMAGE_PREFIX = "badge-"; // one registered image per distinct badge color actually seen, see _registerBadgeColors
// Custom drag payload MIME type for moving an already-uploaded file between
@@ -897,7 +900,7 @@ export class GpxPanelControl {
// clusterRadius/clusterMaxZoom are harmless when there's nothing dense
// enough to cluster (a handful of waypoints just render individually).
this._map.addSource(pointsId, { type: "geojson", data: points, cluster: true, clusterRadius: 50, clusterMaxZoom: 14 });
const badgeColors = new Set(points.features.map((f) => f.properties.color));
const badgeColors = new Set([...points.features.map((f) => f.properties.color), ...CLUSTER_COLORS]);
await Promise.all([this._registerCategoryGlyphs(new Set(points.features.map((f) => f.properties.icon))), this._registerBadgeColors(badgeColors)]);
if (!this._map.getSource(pointsId)) return true; // a style.load (basemap switch) tore it down while icons were loading
@@ -912,21 +915,21 @@ export class GpxPanelControl {
}
// A single-hue, light->dark ramp keyed on point_count (magnitude, not
// category) for the clustered circles; individual points below that use
// category) for the cluster badges; individual points below that use
// each waypoint's own category color (see Maptool::Gpx#waypoint_color),
// falling back to the plain track color for waypoints with no category
// (e.g. a hand-placed GNSS pin, not from a POI export).
_addClusterLayers(pointsId, path) {
this._map.addLayer({
id: `${pointsId}-clusters`,
type: "circle",
type: "symbol",
source: pointsId,
filter: ["has", "point_count"],
paint: {
"circle-radius": ["step", ["get", "point_count"], 16, 25, 20, 100, 26],
"circle-color": ["step", ["get", "point_count"], "#a8c8ea", 25, "#5b9bd5", 100, "#2e6da4"],
"circle-stroke-color": "#fff",
"circle-stroke-width": 1.5,
layout: {
"icon-image": ["step", ["get", "point_count"], badgeImageId(CLUSTER_COLORS[0]), 25, badgeImageId(CLUSTER_COLORS[1]), 100, badgeImageId(CLUSTER_COLORS[2])],
"icon-size": ["step", ["get", "point_count"], 32 / POI_ICON_IMAGE_SIZE, 25, 40 / POI_ICON_IMAGE_SIZE, 100, 52 / POI_ICON_IMAGE_SIZE],
"icon-allow-overlap": true,
"icon-ignore-placement": true,
},
});
this._map.addLayer({
@@ -947,20 +950,20 @@ export class GpxPanelControl {
// default center anchoring is simplest and also means the glyph layer
// below needs no offset, just the same center anchor.
// A point with no NPS symbol (a Google saved place, a bare GPX
// waypoint) is a small dot instead, like a place on an NPS map — an
// waypoint) is a small badge instead, about half the size — a full-size
// empty badge read as a big red square.
const single = ["!", ["has", "point_count"]];
const hasSymbol = ["in", ["get", "icon"], ["literal", POI_ICON_KEYS]];
this._map.addLayer({
id: `${pointsId}-dot`,
type: "circle",
type: "symbol",
source: pointsId,
filter: ["all", single, ["!", hasSymbol]],
paint: {
"circle-radius": ["interpolate", ["linear"], ["zoom"], 6, 3.5, 14, 6],
"circle-color": ["get", "color"],
"circle-stroke-color": "#fff",
"circle-stroke-width": 1.5,
layout: {
"icon-image": ["concat", BADGE_IMAGE_PREFIX, ["get", "color"]],
"icon-size": ["interpolate", ["linear"], ["zoom"], 6, 8 / POI_ICON_IMAGE_SIZE, 14, 13 / POI_ICON_IMAGE_SIZE],
"icon-allow-overlap": true,
"icon-ignore-placement": true,
},
});
this._map.addLayer({