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

feat: polygon prevent overlapping in ModifyMode #900

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anton-gustafsson
Copy link

@anton-gustafsson anton-gustafsson commented Apr 11, 2024

Hi! this PR adds preventOverlappingLines support for ModifyMode.

Also fixed an edge case in drawPolygon if the first dot was pressed (closing the polygon) the line could still be overlapped

@CLAassistant
Copy link

CLAassistant commented Apr 11, 2024

CLA assistant check
All committers have signed the CLA.

@@ -119,9 +119,21 @@ export class DrawPolygonMode extends GeoJsonEditMode {
coordinates: [[...clickSequence, clickSequence[0]]],
};

const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);

if (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes If first editHandle was clicked and last line being created would overlapp

editAction.updatedData &&
hasPolygonCrossingLines(
editAction.updatedData.features[editAction.editContext.featureIndexes[0]].geometry
.coordinates[0] as Position[]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any ideas to remove this cast to Position[]?

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