Skip to content

Add campaign data: Journey#1416

Open
ndelangen wants to merge 53 commits intoAzgaar:masterfrom
ndelangen:norbert/campaign-journey
Open

Add campaign data: Journey#1416
ndelangen wants to merge 53 commits intoAzgaar:masterfrom
ndelangen:norbert/campaign-journey

Conversation

@ndelangen
Copy link
Copy Markdown

@ndelangen ndelangen commented May 7, 2026

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:
Screenshot 2026-05-08 at 17 04 34
Screenshot 2026-05-08 at 17 04 56
Screenshot 2026-05-08 at 17 05 04
Screenshot 2026-05-08 at 17 08 29
Screenshot 2026-05-08 at 17 09 26
Screenshot 2026-05-08 at 17 10 10

ndelangen added 11 commits May 7, 2026 02:39
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.
Copilot AI review requested due to automatic review settings May 7, 2026 00:44
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 5a8ee41
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/69fe464ab01d550009559d83
😎 Deploy Preview https://deploy-preview-1416--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .map saves/loads and adds the #journeys SVG 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.

Comment thread src/modules/journey-draw.ts Outdated
Comment thread src/modules/journey-draw.ts Outdated
Comment thread src/modules/journey-model.ts Outdated
Comment thread src/modules/journey-draw.ts Outdated
Comment thread public/modules/io/load.js Outdated
@Azgaar
Copy link
Copy Markdown
Owner

Azgaar commented May 7, 2026

Hey and thanks for the contribution! Looks good, but pretty limited for now :)

  1. First, can we turn it into Journeys? I mean why only a single Journey is available? Users probably want more and an overview dialog where they can control which ones are displayed.
  2. From what I see we can use Marker names, not ids.
  3. Can we allow users just to click on a cell to add a journey point?
  4. Also I would like it to use pathfinding, at least optionally.
  5. We can calculate distances for users. Travel time can come later.
  6. And the last one, the code is very messy and not elegant. A big portion of it is just not required as we already have all we need in place. It will probably be better to wright it from the scratch in one prompt, then it can be cleaner.

Comment thread public/modules/ui/layers.js Outdated
Comment thread public/modules/ui/layers.js Outdated
Comment thread public/modules/ui/layers.js Outdated
Comment thread public/modules/ui/layers.js Outdated
Comment thread src/modules/journey-model.ts Outdated
Comment thread src/types/PackedGraph.ts Outdated
Comment thread src/index.html Outdated
Comment thread src/index.html Outdated
Comment thread tests/e2e/fixtures.ts Outdated
Comment thread playwright.config.ts
ndelangen added 11 commits May 7, 2026 23:29
…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.
ndelangen added 5 commits May 8, 2026 00:21
…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.
@ndelangen
Copy link
Copy Markdown
Author

ndelangen commented May 8, 2026

Thank you for your in-depth review, @Azgaar
I appreciate your time a lot

First, can we turn it into Journeys? I mean why only a single Journey is available? Users probably want more and an overview dialog where they can control which ones are displayed.

done

And the last one, the code is very messy and not elegant. A big portion of it is just not required as we already have all we need in place. It will probably be better to wright it from the scratch in one prompt, then it can be cleaner.

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.

From what I see we can use Marker names, not ids.

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.
And I'd have quite a few questions about how those features would work in practice.

Can we allow users just to click on a cell to add a journey point?

I could add a third type of JourneyLeg, that just point to a coordinate, I guess?

Also I would like it to use pathfinding, at least optionally.

I would find it really daunting to implement, even if I knew all the exact details.

  • How path-finding work?
  • Do we follow routes?
  • What if there are no routes connecting?
  • Do we avoid ocean?
  • Have rules regarding heightmap?
  • Follow the edge/center of cells?

We can calculate distances for users. Travel time can come later.

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?
Screenshot 2026-05-08 at 17 28 52

ndelangen added 23 commits May 8, 2026 12:20
…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.
… of rows in journeyRenderStopRows function. Update import path for PackJourney type to align with module structure.
…urney

improve gradient editing for journeys
…sy-Map-Generator into norbert/campaign-journey
@Azgaar
Copy link
Copy Markdown
Owner

Azgaar commented May 8, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants