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

doubleclick on map get's polygon stuck in "self intersection" state #631

Closed
smeijer opened this issue Jul 15, 2020 · 8 comments
Closed

doubleclick on map get's polygon stuck in "self intersection" state #631

smeijer opened this issue Jul 15, 2020 · 8 comments
Labels

Comments

@smeijer
Copy link

smeijer commented Jul 15, 2020

When using both allowSelfIntersection: false, and finishOn: dblclick to finish polygons, the double click gets the polygon stuck in an intersecting state.

To reproduce: jsfiddle

  1. Initialize with:
map.pm.addControls({
  position: 'topleft',
});

map.pm.setGlobalOptions({
  allowSelfIntersection: false,
  finishOn: 'dblclick',
});
  1. Click the draw polygon button

  2. Create a polygon with 3 (or more) vertices

  3. Finish by clicking the mouse button twice (dblclick).

  4. Polygon is now stuck in an intersecting state, so it can't be closed/finished.

pm-self-intersect

@smeijer smeijer changed the title Can't use finishOn: dblclick and allowSelfIntersection together When using allowSelfIntersection: false, doubleclick on map get's polygon stuck in intersection state Jul 15, 2020
@smeijer smeijer changed the title When using allowSelfIntersection: false, doubleclick on map get's polygon stuck in intersection state doubleclick on map get's polygon stuck in "self intersection" state Jul 15, 2020
@smeijer
Copy link
Author

smeijer commented Jul 15, 2020

I've updated the title, as it turns out that it doesn't have anything to do with the finishOn: 'dblclick' part. Also without that setting, the polygon gets stuck when double-clicking the map.

@Falke-Design
Copy link
Collaborator

Thx for reporting! This is already fixed in the develop branche #621
But I found a new bug in the develop version. When dblclick is called no vertex is created.

@smeijer
Copy link
Author

smeijer commented Jul 15, 2020

That's awesome!

Regarding your finding. Is that a bug, or a feature? I think it is actually a nice user experience if a double click doesn't add a vertex. Especially in the mode where double click finishes the feature. This would prevent accidental vertex insertions, where users don't want to add a vertex, but just want to finish the feature.

@Falke-Design
Copy link
Collaborator

We can discuss about this but I use it to create the last vertex and then finish it at the same time. When I want to finish the polygon without creating a vertex I click on the first marker.

@codeofsumit how do you see that?

@smeijer
Copy link
Author

smeijer commented Jul 16, 2020

Would it be possible to publish a patch or prerelease that contains this bug fix?

@codeofsumit
Copy link
Contributor

I will release a patch version within the next few days 👌

@JamboBuenna
Copy link

@codeofsumit Any idea when this patch is going to go out as an npm package.
Picked up the code change on develop and this fix works great, but having problems getting our build pipeline working against your dev branch and would prefer to fix to an npm release.

@codeofsumit
Copy link
Contributor

Yeah sorry for not having released sooner. I'm on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants