Skip to content

Conversation

megawac
Copy link
Contributor

@megawac megawac commented May 22, 2024

How to

Create some absurd shapes as described in #267 or allow a high nbFeatures. Set limitGuidesPerFeature on your cad control (defaults to 3). Observe that the max number of snapping guides ever shown on the screen is nbFeatures X limitGuidesPerFeatures

Notes on Implementation

I included lodash here as a peer dependency as my project uses it anyway. The main need was to get access to sortByIndex which allows the includedCoords array to be built optimally in the parseCoordList function. This can easily be replaced by something like the following with efficiency tradeoffs

coords.sort((a, b) => euclideanDistance(a, coordinate) - euclideanDistance(b, coordinate));
const includedCoords = coords.slice(0, this.limitGuidesPerFeature);

Others

  • It's not a hack or at least an unauthorized hack :).
  • Everything in ticket description has been fixed.
  • The author of the MR has made its own review before assigning the reviewer.
  • The title is formatted as a conventional-commit message.
  • Tests added.

Fixes #267

Copy link

vercel bot commented May 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openlayers-editor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 27, 2024 7:09pm

@megawac
Copy link
Contributor Author

megawac commented Aug 27, 2024

I've switched to the simple solution without sortedIndex, these arrays hopefully are not that large to make it make a significant difference.

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.

Complex geometries can generate a large number of cad guides

2 participants