From bf90f4cf2357adcbc7755af1d86a816e9f8cbf25 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Fri, 4 Dec 2026 14:28:32 +0100 Subject: [PATCH] =?UTF-8?q?Rounded,=20after=20the=20Design=20canvas'=20Gri?= =?UTF-8?q?dRounded:=20drive=20mode's=20cells=20and=20keys=20with=2012=20p?= =?UTF-8?q?x=20corners=20on=20a=20black=20ground,=20the=20gaps=20(3=20px?= =?UTF-8?q?=20a=20side)=20out=20of=20them,=20the=20map=20keeping=20its=20a?= =?UTF-8?q?rea=20with=20corners=20of=20its=20own;=20the=20map's=20points?= =?UTF-8?q?=20one=20frame,=20the=20NPS=20rounded=20square=20=E2=80=94=20th?= =?UTF-8?q?e=20trip's=20stops,=20the=20search=20pins,=20the=20clusters=20a?= =?UTF-8?q?nd=20the=20points=20with=20no=20pictogram=20(badges=20like=20th?= =?UTF-8?q?e=20p4n/OsmAnd=20ones)=20instead=20of=20circles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 28 ++++++++++++++++++++++++++-- public/js/gpx.js | 33 ++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 396406d..c821e06 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -3019,7 +3019,7 @@ button.basemap-panel__link[hidden] { display: none; } .route-marker { width: 22px; height: 22px; - border-radius: 50%; + border-radius: 5px; /* the NPS rounded square, like the points' badges */ background: #1d6fdc; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); @@ -3800,7 +3800,7 @@ html.driving .drive-panel { grid-area: var(--drive-menu, 2 / 10 / 10 / 17); } .drive-trip[data-mode="search"] .drive-trip__search { grid-row: 2 / 3; } .drive-trip[data-mode="search"] .drive-trip__search input { border: 2px solid var(--drive-key-on); } /* the search's results on the map and in the list: saved points cyan, places amber */ -.drive-pin { width: calc(14px * var(--s, 1)); height: calc(14px * var(--s, 1)); flex: none; border-radius: 50%; box-shadow: 0 0 0 2px #fff; } +.drive-pin { width: calc(14px * var(--s, 1)); height: calc(14px * var(--s, 1)); flex: none; border-radius: 3px; box-shadow: 0 0 0 2px #fff; } .maplibregl-marker.drive-pin { width: calc(18px * var(--s, 1)); height: calc(18px * var(--s, 1)); box-shadow: 0 0 0 2.5px #fff, 0 1px 4px rgb(0 0 0 / 0.4); } .drive-pin--saved { background: #12bedf; } .drive-pin--place { background: #e8a200; } @@ -4923,6 +4923,30 @@ html.driving .drive-cell--field { position: relative; } .drive-rec__tick input { width: 30px; height: 30px; accent-color: var(--drive-key-on); } .drive-rec__day .drive-panel__text { flex: 1; justify-content: center; padding: 0 12px; } .drive-rec__day .drive-panel__look { width: var(--cell, 80px); flex: none; background: none; } + +/* Rounded (the Design canvas' GridRounded): the cells and keys with soft + corners on a black ground, the gaps taken out of them (3 px a side) — the + map keeps its area, framed with corners of its own. Overrides the 1 px + lines of the grid and its menus above. */ +:root { --drive-ground: #000; --drive-radius: 12px; --drive-half-gap: 3px; } +html.driving #app, +.drive-panel, +.drive-trip__stops, +.drive-trip__results, +.drive-panel__list, +.drive-points__bar, +.drive-layers__presets, +.drive-layers__source, +.drive-rec__days { gap: 0; background: var(--drive-ground); } +.drive-cell, +.drive-panel__cell, +.drive-panel__empty, +.drive-rec__day, +.drive-panel > :not(.drive-trip__stops, .drive-trip__results, .drive-panel__list, .drive-points__bar, .drive-layers__presets, .drive-layers__source, .drive-rec__days) { + margin: var(--drive-half-gap); + border-radius: var(--drive-radius); +} +html.driving .app-body { border-radius: calc(var(--drive-radius) + 2px); overflow: hidden; } .drive-rec__cutrow { flex: none; height: calc(var(--cell, 80px) / 2); display: flex; align-items: center; gap: 10px; padding-left: 28px; background: var(--band); color: var(--drive-muted); font-size: calc(14px * var(--s, 1)); } .drive-rec__cutrow span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .drive-panel .drive-rec__cutrow button { height: 100%; padding: 0 16px; background: none; border-left: 1px solid var(--drive-line); font-size: calc(14px * var(--s, 1)); font-weight: 700; } diff --git a/public/js/gpx.js b/public/js/gpx.js index afa6768..b1d089a 100644 --- a/public/js/gpx.js +++ b/public/js/gpx.js @@ -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({