Skip to content

Preserve adjacent negative polygon coordinates - #3027

Open
OskarEichler wants to merge 1 commit into
software-mansion:mainfrom
OskarEichler:codex/preserve-negative-poly-points
Open

Preserve adjacent negative polygon coordinates#3027
OskarEichler wants to merge 1 commit into
software-mansion:mainfrom
OskarEichler:codex/preserve-negative-poly-points

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

extractPolyPoints tries to insert a separator before a minus sign that follows another coordinate, but its regex consumes the preceding character and replaces only the first match. Valid points such as 0,0 10-10 20-20 become 0 0 1 -10 20-20, corrupting Polygon and Polyline geometry.

Capture and preserve the character before each adjacent minus and apply the replacement globally. Exponent signs such as 1e-3 remain part of the same number.

Test Plan

What is required?

The existing Jest environment.

Steps and results

  • Added a regression covering multiple adjacent negative coordinates; exact baseline loses the zero from 10 and leaves the second pair unsplit.
  • Added an exponent regression proving 1e-3 remains intact.
  • Exact baseline passes 1/2; the fixed focused suite passes 2/2.
  • yarn test, yarn bob, and git diff --check pass.

Compatibility

OS Implemented
iOS
MacOS
Android
Web

Checklist

  • I have tested this on a device and a simulator — pure shared parser behavior covered by Jest
  • I added documentation in README.md — no public API or documentation change
  • I updated the typed files (TypeScript parser implementation)
  • I added regression tests in the __tests__ folder

Breaking changes

Only previously corrupted valid point strings change; API and correctly parsed inputs are unchanged.

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.

1 participant