Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] preventOverlappingLines does not check completed polygon for intersections if user hits Enter or double-click #157

Open
1 of 8 tasks
solarissmoke opened this issue Nov 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@solarissmoke
Copy link

solarissmoke commented Nov 20, 2024

Module

  • deck.gl-community/arrow-layers
  • deck.gl-community/bing-maps
  • deck.gl-community/editable-layers
  • deck.gl-community/experimental
  • deck.gl-community/graph-layers
  • deck.gl-community/layers
  • deck.gl-community/react
  • deck.gl-community/react-graph-layer

Description

When preventOverlappingLines is set to true, DrawPolygonMode prevents placing new vertices that overlap with the polygon. However, it is possible to create a self-intersection that is not detected, as demonstrated here:

Screencast.from.2024-11-20.06-35-51.webm

Notice that the polygon was successfully created, despite it having a self-intersection. This is because the current implementation doesn't check for intersection of the closing line segment of the polygon (between the last placed vertex, and the first vertex).

Expected Behavior

The self-intersection created above shouldn't be possible when preventOverlappingLines is turned on. Intersection needs to be checked on the final line segment.

Steps to Reproduce

See screen capture above - with preventOverlappingLines turned on, it is still possible to create a self-intersecting polygon.

Environment

Logs

No response

@solarissmoke solarissmoke added the bug Something isn't working label Nov 20, 2024
@solarissmoke
Copy link
Author

I'm not sure what the best solution here is, so would be grateful for some guidance before I attempt a PR to fix it. We could check that the whole tentative polygon has no intersections, but you will notice that in the example above it is still possible to make the polygon valid by placing a new vertex near the bottom left of the enclosed area - so it doesn't seem quite correct to block placement of the vertex.

The alternative would be to check the entire polygon on Enter/double-click - in which case the question is what the behaviour should be if a self-intersection is found at that stage: remove last placed vertex and don't complete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant