Skip to content

Replace split lat/lon inputs with single combined coordinate field - #57

Merged
adam133 merged 2 commits into
mainfrom
copilot/rework-coordinates-input-menu
Mar 21, 2026
Merged

Replace split lat/lon inputs with single combined coordinate field#57
adam133 merged 2 commits into
mainfrom
copilot/rework-coordinates-input-menu

Conversation

Copilot AI commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

On macOS, pasting coordinates into separate Latitude/Longitude fields drops minus signs, commas, and decimal points, making manual coordinate entry unreliable. Consolidates the two fields into one "lat, lon" string input.

Changes

  • OsmLevelLoader — new TryParseCoordinates(string, out double, out double) static helper: splits on first comma, trims whitespace, parses each part with invariant culture
  • CoordinateEntryHud (IMGUI in-game dialog) — merged _latStr/_lonStr → single _coordsStr; added hint label e.g. 51.5074, -0.1278
  • StartupMenuUi (uGUI startup menu) — merged _latField/_lonField → single _coordsField with ContentType.Standard so all characters (minus, comma, period, space) paste freely; panel height reduced 40px
  • OsmLevelLoaderTests — 11 new unit tests for TryParseCoordinates covering valid inputs, whitespace variants, null/empty, missing comma, and non-numeric parts
"51.5074, -0.1278"   → lat=51.5074  lon=-0.1278  ✓
"-33.8688, -70.6693" → lat=-33.8688 lon=-70.6693 ✓
"51.5074 -0.1278"    → false (no comma)           ✗
"abc, def"           → false (non-numeric)         ✗
Original prompt

Rework the coordinates input menu - instead of two separate fields, parse the coordinates from a single input string. On mac, coordinates don't copy paste strings correctly, minus, comma, and decimals don't get pasted.

on the new single input, do validation to make sure there's a comma separating two decimal numbers


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add OsmLevelLoader.TryParseCoordinates() static helper for parsing "lat, lon" strings
- Replace separate lat/lon fields with single Coordinates field in CoordinateEntryHud (IMGUI)
- Replace separate lat/lon TMP_InputFields with single Coordinates field in StartupMenuUi (uGUI)
- Add 11 unit tests for TryParseCoordinates covering valid/invalid/edge cases

Co-authored-by: adam133 <20442729+adam133@users.noreply.github.com>
Agent-Logs-Url: https://github.com/adam133/terradrive/sessions/bc83221f-b747-486e-8056-e5ceecfbbca7
Copilot AI changed the title [WIP] Rework coordinates input to use single string for parsing Replace split lat/lon inputs with single combined coordinate field Mar 21, 2026
Copilot AI requested a review from adam133 March 21, 2026 19:57
@adam133
adam133 marked this pull request as ready for review March 21, 2026 20:55
@adam133
adam133 merged commit ae37ae4 into main Mar 21, 2026
12 checks passed
@adam133
adam133 deleted the copilot/rework-coordinates-input-menu branch March 21, 2026 20:55
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.

2 participants