Skip to content

#1075 Ray guided line path#1381

Open
thekingofcity wants to merge 4 commits intomainfrom
1075
Open

#1075 Ray guided line path#1381
thekingofcity wants to merge 4 commits intomainfrom
1075

Conversation

@thekingofcity
Copy link
Member

Summary

This PR adds a new pro-only line path, ray-guided, exposed to users as Arbitrary angle path.

Changes

  • add the new ray-guided line path with:
    • start angle
    • end angle
    • starting point offset
    • ending point offset
    • round corner factor
  • upgrade @railmapgen/rmg-components to 10.1.13 and use RmgCircularSlider
  • implement the undirected angle model:
    • store angles in the 0..179 range
    • treat 0 and 180 as the same direction
    • use the upward direction as 0
  • allow circular slider interaction on the full 0..359 dial while normalizing stored values to 0..179
  • prevent invalid parallel guide rays by disabling ±5° around the opposite angle on both halves of the dial
  • disable parallel support for ray-guided for now
  • add fixed orthogonal default values for newly created ray-guided paths
  • handle ray-guided reversal correctly in fill generation
  • update the user-facing name to Arbitrary angle path and update its icon
  • mark ray-guided as a pro-only line path:
    • unsubscribed users can still see it in the tools panel
    • the button is disabled and shows a PRO badge
    • existing ray-guided paths remain editable, matching the current simple behavior

Tests

  • add tests for ray-guided path generation
  • add tests for angle normalization and disabled slider values
  • add tests to ensure parallel indexing is disabled for ray-guided

Verification

  • npx tsc --noEmit
  • npm run lint
  • npm test -- --run

@thekingofcity thekingofcity changed the title Add the arbitrary angle path #1075 Arbitrary angle path Mar 15, 2026
@thekingofcity thekingofcity changed the title #1075 Arbitrary angle path #1075 Ray guided line path Mar 15, 2026
@thekingofcity thekingofcity linked an issue Mar 15, 2026 that may be closed by this pull request
Copy link
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 pro-only line path type (ray-guided) exposed as Arbitrary angle path, integrating it across rendering, UI, persistence, and parallel-line handling.

Changes:

  • Introduces the ray-guided line path with undirected-angle storage (0..179), angle normalization, and a circular-slider editor UI.
  • Gates parallel-line features via supportsParallelLinePath() to exclude simple and ray-guided, and updates creation/import/process flows accordingly.
  • Bumps save version to 69, adds upgrade + tests, updates i18n strings and style/path compatibility lists.

Reviewed changes

Copilot reviewed 52 out of 53 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/util/save.ts Bumps save version to 69 and adds 68→69 upgrade step.
src/util/save.test.ts Adds coverage for the 68→69 upgrade.
src/util/process-elements.ts Skips parallel processing for unsupported line path types via supportsParallelLinePath.
src/util/parallel.ts Centralizes parallel support gating and updates parallel grouping/types accordingly.
src/util/parallel.test.ts Adds a unit test asserting ray-guided disables parallel indexing.
src/util/clipboard.ts Ensures pasted edges don’t retain/recompute parallel index for unsupported path types.
src/util/change-types.ts Prevents auto-parallel index generation when switching to unsupported path types.
src/constants/lines.ts Adds LinePathType.RayGuided and registers its external attributes type.
src/components/svgs/lines/paths/ray-guided.tsx Implements ray-guided path generation + attribute editor UI and marks it as pro-only.
src/components/svgs/lines/paths/ray-guided.test.ts Adds tests for path generation, normalization, and disabled slider values.
src/components/svgs/lines/lines.ts Registers the new ray-guided path in linePaths.
src/components/svgs/nodes/fill.tsx Handles ray-guided reversal correctly for fill path generation.
src/components/svg-wrapper.tsx Restricts startFrom toggling logic to parallel-supporting path types only.
src/components/svg-canvas-graph.tsx Avoids assigning parallel indices for unsupported path types during edge creation.
src/components/panels/tools/tools.tsx Displays pro-only paths for unsubscribed users as disabled with a PRO badge.
src/components/panels/details/info-section.tsx Disables parallel controls for unsupported path types via supportsParallelLinePath.
src/i18n/translations/en.json Adds rayGuided displayName and start/end angle labels.
src/i18n/translations/ja.json Adds rayGuided displayName and start/end angle labels.
src/i18n/translations/ko.json Adds rayGuided displayName and start/end angle labels.
src/i18n/translations/zh-Hans.json Adds rayGuided displayName and start/end angle labels.
src/i18n/translations/zh-Hant.json Adds rayGuided displayName and start/end angle labels.
src/components/svgs/lines/styles/single-color.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/shmetro-virtual-int.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/shanghai-suburban-railway.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/river.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/mtr-unpaid-area.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/mtr-race-day.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/mtr-paid-area.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/mtr-light-rail.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/mrt-under-construction.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/mrt-sentosa-express.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/lrt-single-color.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-tube-terminal.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-tube-internal-int.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-tube-10-min-walk.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-sandwich.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-rail.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-ifs-cloud-cable-car.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/london-DART.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/jr-east-single-color.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/jr-east-single-color-pattern.tsx Adds RayGuided to supported line path types (expanded list formatting).
src/components/svgs/lines/styles/gzmtr-virtual-int.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/gzmtr-loop.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/guangdong-intercity-railway.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/chongqingrt-loop.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/chongqingrt-line-badge.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/china-railway.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/chengdurt-outside-fare-gates.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/bjsubway-tram.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/bjsubway-single-color.tsx Adds RayGuided to supported line path types.
src/components/svgs/lines/styles/bjsubway-dotted.tsx Adds RayGuided to supported line path types.
package.json Upgrades @railmapgen/rmg-components to ^10.1.13.
package-lock.json Locks @railmapgen/rmg-components to 10.1.13.

You can also share your feedback on Copilot code review. Take the survey.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Allow non-45°/90° angles

2 participants