Add campaign data: Journey#1416
Conversation
Guard SVG CRLF normalization when the embedded <svg id="map"> block is missing or mismatched, so we never call .includes on undefined. Normalize pack.journey from data[40]: tolerate absent rows, invalid JSON, null, and non-object shapes; always ensure points is an array so journey draw/sync cannot throw on legacy files. When applying layer presets, fall back to built-in defaults if localStorage merged presets omit a key or store a non-array; skip invalid entries in getCurrentPreset and avoid mutating stored arrays when comparing. Harden tooltip lookup when parentNode is missing. Bump cache versions for load.js, layers.js, and general.js. Playwright load-map snapshots updated where baselines were missing.
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Adds a new “Journey” campaign layer that stores an ordered sequence of burg/marker stops, renders it as a directional path (with arrows + zoom-constant sizing), and provides UI + persistence so it can be edited and saved/loaded as part of a map.
Changes:
- Introduces a journey data model + renderer (TypeScript) and wires it into the legacy UI layer system (toggle, presets, zoom syncing, style editing, tools + hotkeys).
- Persists journey data in
.mapsaves/loads and adds the#journeysSVG layer plus default style attributes across built-in presets. - Expands Playwright E2E coverage with shared fixtures, a journey layer spec, and a local-only visual regression suite; updates Playwright baseURL handling to work under
/Fantasy-Map-Generator/.
Reviewed changes
Copilot reviewed 41 out of 43 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e/zones-export.spec.ts | Switches to shared Playwright fixtures + baseURL-relative navigation. |
| tests/e2e/visual-regression.spec.ts | Adds local-only pixel regression tests for the root SVG. |
| tests/e2e/states.spec.ts | Switches to shared fixtures + baseURL-relative navigation. |
| tests/e2e/load-map.spec.ts | Switches to shared fixtures + baseURL-relative navigation. |
| tests/e2e/layers.spec.ts | Uses shared fixtures and adds end-frame screenshots (local-only) for passed tests. |
| tests/e2e/lakes-layer.spec.ts | Switches to shared fixtures + baseURL-relative navigation. |
| tests/e2e/journey-layer.spec.ts | Adds E2E coverage for journey toggling, normalization, rendering, zoom sizing, and editor opening. |
| tests/e2e/fixtures.ts | New shared Playwright helpers and (local-only) end-frame screenshot hook. |
| tests/e2e/burgs.spec.ts | Switches to shared fixtures + baseURL-relative navigation. |
| src/types/PackedGraph.ts | Extends packed map typing to include optional journey. |
| src/types/global.ts | Adds global typings for the journeys layer selection and syncJourneyZoom. |
| src/modules/journey-model.ts | New journey data model, legacy migration/normalization, and stop resolution helpers. |
| src/modules/journey-model.test.ts | Unit tests for journey normalization and resolution behavior. |
| src/modules/journey-draw.ts | New journey renderer (segments, arrows, LOD, zoom-constant sizing) and style config parsing. |
| src/modules/journey-draw.test.ts | Unit tests for renderer math/helpers (LOD, spacing, parsing, etc.). |
| src/modules/index.ts | Registers the journey renderer module in the TS bundle. |
| src/index.html | Adds Journey layer toggle, style editor section, tool button, journey editor dialog shell, and script include. |
| public/versioning.js | Bumps app version and adds Journey to the public change log. |
| public/styles/watercolor.json | Adds default #journeys style attributes for the preset. |
| public/styles/pale.json | Adds default #journeys style attributes for the preset. |
| public/styles/night.json | Adds default #journeys style attributes for the preset. |
| public/styles/monochrome.json | Adds default #journeys style attributes for the preset. |
| public/styles/light.json | Adds default #journeys style attributes for the preset. |
| public/styles/gloom.json | Adds default #journeys style attributes for the preset. |
| public/styles/default.json | Adds default #journeys style attributes for the preset. |
| public/styles/darkSeas.json | Adds default #journeys style attributes for the preset. |
| public/styles/cyberpunk.json | Adds default #journeys style attributes for the preset. |
| public/styles/clean.json | Adds default #journeys style attributes for the preset. |
| public/styles/atlas.json | Adds default #journeys style attributes for the preset. |
| public/styles/ancient.json | Adds default #journeys style attributes for the preset. |
| public/modules/ui/tools.js | Hooks the Tools “Journey” button to open the journey editor. |
| public/modules/ui/style.js | Adds Journey style editor UI wiring (data-* attributes + redraw). |
| public/modules/ui/style-presets.js | Ensures Journey redraws when applying style presets (if visible). |
| public/modules/ui/layers.js | Adds Journey to presets, adds draw/toggle/zoom-sync plumbing, and adds layer lookup mapping. |
| public/modules/ui/journey-editor.js | New legacy UI editor for building/editing journey stops via burg/marker refs. |
| public/modules/ui/hotkeys.js | Adds Shift+J hotkey to open the journey editor. |
| public/modules/ui/general.js | Hardens tooltip handling via optional chaining. |
| public/modules/io/save.js | Serializes pack.journey into saved .map data. |
| public/modules/io/load.js | Creates/selects #journeys, loads/normalizes journey data, restores layer-on state, and triggers draw. |
| public/main.js | Adds the #journeys SVG group, syncs journey zoom sizing, and initializes pack.journey on generation. |
| playwright.config.ts | Updates baseURL/webServer config for Vite base path + adds screenshot expect thresholds. |
| package.json | Formatting-only change. |
| package-lock.json | Lockfile metadata changes. |
|
Hey and thanks for the contribution! Looks good, but pretty limited for now :)
|
…butes and refactor numeric attribute parsing. Added a test case to verify that data-outline-screen-px retains a value of 0 without falling back to defaults.
…ries function, which returns resolved stops with their coordinates. Update JourneyDrawModule to utilize resolved stops instead of coordinates directly. Add tests for journeyResolvedStopEntries to ensure correct functionality.
…ead of ruler in load.js. Increment version number for load.js in index.html to 1.122.2.
… with indexed lookups for burgs and markers. Update journeyResolutionCtx to utilize the new function. Add tests for buildJourneyResolutionContext to verify correct functionality.
…to ensure pack.journey exists and is properly structured. Update journey editor to utilize this new function for managing journey stops. Remove deprecated journey-editor.js and update related modules for improved journey management.
…urney-editor. Remove deprecated journeyResolutionCtx function and streamline context creation by directly using buildJourneyResolutionContext. Update related logic for improved clarity and maintainability.
…o use updated imports and improve URL handling. Clean up unused code and enhance SVG parsing logic for better compatibility.
…acy `stopIds` and `waypoints`. Update tests to reflect changes in behavior, ensuring that legacy identifiers are no longer inferred and are removed from the journey object. Clean up unused functions related to legacy stop handling.
…remove legacy stop handling and simplify normalization logic. Adjust tests to reflect changes in journey behavior.
|
Thank you for your in-depth review, @Azgaar
done
I've made significant efforts to improve code changes, however, I need to guess a bit exactly what you consider messy, as it's rather subjective.
Can you elaborate on this? Regarding these points, I'm not quite sure what to do, as they don't match my personal use case.
I could add a third type of
I would find it really daunting to implement, even if I knew all the exact details.
Distance (straight line) is already calculable using the Rulers feature, so this would only be useful if these Journeys did indeed follow some pathing logic? |
…nd `waypoints`. Update type definitions and normalize test cases to focus on `stops[]`. Clean up unused assertions and improve clarity in test descriptions.
…nitions by removing unnecessary exports. Update mapping logic in journey-draw to enhance clarity and maintainability.
…unction for HTML string safety. Replace clamp function with minmax for improved range handling in journey module. Clean up unused escape functions and enhance clarity in journeyStopSelectOptions.
…y in journey module
… of rows in journeyRenderStopRows function. Update import path for PackJourney type to align with module structure.
allow for many Journeys
…urney improve gradient editing for journeys
…sy-Map-Generator into norbert/campaign-journey
|
Hello, I'm going work on it, but later, looks like a nice small feature for a weekend. But currently we have too many updates coming. This update effect map data, but it should come to master in more or less final stage to avoid need in data migrations in the future. |

Relatations
https://trello.com/c/NCbZOG2G/2-travel-builder
Description
I've added a new layer showing a new type of data: a path/journey.
This is a directional line that extends along many points.
I've chosen to use burgs and markers as selectable points that a journey can use.
The journey can be edited, extended, and styled.
Fair disclosure: I have used AI coding tools to assist me in making the code changes.
Here are some demo screenshots:





