fix: globe aware custom path and date format in user preference#657
fix: globe aware custom path and date format in user preference#657idunwannagotoschool wants to merge 15 commits into
Conversation
interpolate coordinates with turf.js
|
Label error. Requires exactly 1 of: changelog:.*. Found: Web |
| const interpolatedArcCoords = arcCoords.slice(1).map((coord) => { | ||
| return prev[2] !== undefined ? [coord[0], coord[1], prev[2]] : coord; | ||
| }) as FlightTrackCoordinate[]; |
There was a problem hiding this comment.
🟡 Medium map/flight-layer-data.ts:56
For interpolated segments, the final interpolated coordinate overwrites the original destination point's altitude with prev[2]. When greatCircle returns the endpoint as its last coordinate, arcCoords.slice(1).map(...) replaces curr's altitude value with the previous point's altitude, silently corrupting track altitude data on long or sparse segments. Consider preserving curr as the final coordinate of each interpolated segment instead of using the last arc coordinate.
- const interpolatedArcCoords = arcCoords.slice(1).map((coord) => {
- return prev[2] !== undefined ? [coord[0], coord[1], prev[2]] : coord;
- }) as FlightTrackCoordinate[];
+ const interpolatedArcCoords = arcCoords.slice(1, -1).map((coord) =>
+ prev[2] !== undefined ? [coord[0], coord[1], prev[2]] : coord,
+ ) as FlightTrackCoordinate[];
+ interpolatedArcCoords.push(curr);🤖 Copy this AI Prompt to have your agent fix this:
In file @src/lib/map/flight-layer-data.ts around lines 56-58:
For interpolated segments, the final interpolated coordinate overwrites the original destination point's altitude with `prev[2]`. When `greatCircle` returns the endpoint as its last coordinate, `arcCoords.slice(1).map(...)` replaces `curr`'s altitude value with the previous point's altitude, silently corrupting track altitude data on long or sparse segments. Consider preserving `curr` as the final coordinate of each interpolated segment instead of using the last arc coordinate.
| monthAsNumber = false, | ||
| includeYear = false, | ||
| ) => { | ||
| const locale = localeForDateFormat(prefs.dateFormat); |
There was a problem hiding this comment.
🟡 Medium datetime/format.ts:39
formatAsFlightDate now derives the locale from prefs.dateFormat, passing values like en-GB, en-US, or en-CA into Intl.DateTimeFormat. This forces English month names (Jan, May, etc.) on users whose browser locale is non-English, even though dateFormat only controls field ordering. The month and day cases render short month names via Intl.DateTimeFormat, so any non-English user selecting eu/us/iso loses localized month names in flight dates. Consider using the user's runtime locale for formatting and applying dateFormat only to control field order, or document this as intentional if English is always desired.
🤖 Copy this AI Prompt to have your agent fix this:
In file @src/lib/utils/datetime/format.ts around line 39:
`formatAsFlightDate` now derives the `locale` from `prefs.dateFormat`, passing values like `en-GB`, `en-US`, or `en-CA` into `Intl.DateTimeFormat`. This forces English month names (`Jan`, `May`, etc.) on users whose browser locale is non-English, even though `dateFormat` only controls field ordering. The `month` and `day` cases render short month names via `Intl.DateTimeFormat`, so any non-English user selecting `eu`/`us`/`iso` loses localized month names in flight dates. Consider using the user's runtime locale for formatting and applying `dateFormat` only to control field order, or document this as intentional if English is always desired.
|



Fix #643. Fix #651.
Interpolating coordinates along great circle with turf.js, and flatten when returns MultiLineString when crossing antimeridian.
Pass user preferences to the function used to display the date, similar to the preview.svelte. Does fix the panel but not 100% sure it fixes tooltip as I cannot invoke it.
Before:
After:
Note
Fix globe-aware custom path rendering and apply user date format preferences across flight UI
unwrapTrackPathin flight-layer-data.ts to insert great-circle arc interpolation between successive coordinates that differ by more than 3 degrees, producing smoother paths before longitude unwrapping.formatAsFlightDateand related helpers in format.ts to accept user date preferences, routing formatting throughlocaleForDateFormat(now exported from preferences/format.ts).prefsinto everyformatAsFlightDatecall site across map popups, flight cards, route details, airport detail cards, and the deduplicate tool.Macroscope summarized c5f0cd9.