refactor: migrate resample module#1351
Merged
Azgaar merged 5 commits intoAzgaar:masterfrom Mar 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the legacy resample logic from public/modules/resample.js into the TypeScript module system and replaces the old lineclip browser-global dependency with an npm package import, improving type safety across related utilities.
Changes:
- Add
src/modules/resample.tsand wire it into module initialization; remove the legacypublic/modules/resample.jsscript. - Replace
window.polygonclip/lineclip.min.jsusage withlineclipnpm imports and update clipping call sites. - Tighten types for
PackedGraph, river point data, andisLand/isWaterhelpers.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/graphUtils.ts | Type isLand/isWater against PackedGraph for safer call sites. |
| src/utils/commonUtils.ts | Switch polygon clipping implementation to npm lineclip import. |
| src/types/global.ts | Add missing global declarations needed by the new TS resample module. |
| src/types/PackedGraph.ts | Extend and adjust PackedGraph typing (typed arrays + quadtree field). |
| src/renderers/draw-markers.ts | Rename internal pin helper while keeping window.getPin API stable. |
| src/modules/river-generator.ts | Add optional River.points typing and adjust length calculation typing. |
| src/modules/resample.ts | New TypeScript resample implementation (ported from legacy JS). |
| src/modules/ocean-layers.ts | Update clipPoly call signature after clipping refactor. |
| src/modules/index.ts | Ensure resample module is loaded/registered. |
| src/index.html | Remove legacy resample.js and lineclip.min.js script tags. |
| public/modules/resample.js | Removed legacy resample implementation. |
| public/libs/lineclip.min.js | Removed legacy vendored lineclip library. |
| package.json | Add lineclip (and its types) to npm dependencies. |
| package-lock.json | Lockfile updates for new dependencies. |
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Collaborator
Author
|
@Azgaar this is ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description