From bb1d494c480f3bf7e19e3a88e806a968ee96da10 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 22 May 2026 12:36:06 +0200 Subject: [PATCH] feat(hikes): forgiving map selection, photo lightbox, detail polish Map interaction: - Overview map: widen the canvas renderer hit-test (tolerance) so a route can be hovered/clicked from a comfortable margin instead of demanding a pixel-perfect click on the thin line. - Detail map: drive the elevation cursor from a whole-map mousemove that snaps to the nearest track point within ~70 px (track cached in layer-point space, refreshed on zoom/move), instead of requiring the pointer to ride exactly on the trail. The hover pin now renders for map-sourced hovers too, and is recoloured to nord red as a distinct "you are here" marker. Trail polyline made non-interactive. Detail page: - Move the photo strip above the stats row and trim it (3:2 cards). - Add a fullscreen lightbox: an expand button on each card opens the full-res image with prev/next, arrow keys, Esc, backdrop-close and a body-scroll lock; opening/stepping syncs the map + strip. The card's existing click (map-position sync) is preserved. - Cap inline prose images at 680 px (centered) so they don't blow up to full width in the single-column layout on wider screens; the desktop two-column layout is unaffected. --- package.json | 2 +- src/lib/components/hikes/HikeImage.svelte | 8 +- src/lib/components/hikes/HikeMap.svelte | 54 ++- .../components/hikes/HikePhotoStrip.svelte | 403 ++++++++++++++++-- .../components/hikes/HikesOverviewMap.svelte | 7 +- src/routes/hikes/[slug]/+page.svelte | 12 +- 6 files changed, 424 insertions(+), 62 deletions(-) diff --git a/package.json b/package.json index f6ca8d3b..2f4e61c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homepage", - "version": "1.78.0", + "version": "1.79.0", "private": true, "type": "module", "scripts": { diff --git a/src/lib/components/hikes/HikeImage.svelte b/src/lib/components/hikes/HikeImage.svelte index 88116aa1..27ac014b 100644 --- a/src/lib/components/hikes/HikeImage.svelte +++ b/src/lib/components/hikes/HikeImage.svelte @@ -79,7 +79,13 @@ diff --git a/src/lib/components/hikes/HikesOverviewMap.svelte b/src/lib/components/hikes/HikesOverviewMap.svelte index 1b27021e..b0b233a2 100644 --- a/src/lib/components/hikes/HikesOverviewMap.svelte +++ b/src/lib/components/hikes/HikesOverviewMap.svelte @@ -98,10 +98,15 @@ const L = await import('leaflet'); if (cancelled || !node.isConnected) return; + // `tolerance` widens the canvas renderer's hit-test radius around + // every polyline (hit = weight/2 + tolerance), so a route can be + // hovered/clicked from a comfortable margin instead of demanding a + // pixel-perfect click on the 4 px line. const map = L.map(node, { attributionControl: true, zoomControl: true, - preferCanvas: true + preferCanvas: true, + renderer: L.canvas({ tolerance: 12 }) }); // Sensible default centre (mid-Switzerland) while the polyline // layer is built up; `fitBounds` below overrides it once the diff --git a/src/routes/hikes/[slug]/+page.svelte b/src/routes/hikes/[slug]/+page.svelte index 4c7b0564..243ffe79 100644 --- a/src/routes/hikes/[slug]/+page.svelte +++ b/src/routes/hikes/[slug]/+page.svelte @@ -372,6 +372,12 @@ + {#if track && track.length > 0 && visibleImagePoints.length > 0} +
+ +
+ {/if} +
{#if hike.icon} @@ -445,12 +451,6 @@
{/if} - {#if track && track.length > 0 && visibleImagePoints.length > 0} -
- -
- {/if} -