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

Cut events update #259

Merged
merged 1 commit into from
Jun 18, 2018
Merged

Conversation

jpknapp
Copy link
Contributor

@jpknapp jpknapp commented Nov 30, 2017

when the cut event is fired it includes resulting layers from all the previous cut events, so if you cut several polygons each successive cut event accumulates previous resulting layers

this update only includes resulting layers for the current cutted layer

@codeofsumit
Copy link
Contributor

hey @jpknapp, thanks for the PR and taking the time to go ahead and tackle the problem yourself. Really appreciate it. However I was not able to reproduce the problem.
For me, cutting multiple polygons one after the other always returned the correct results.

Looking at the line of code you changed I'm also quite sure it'd stop serving all resulting polygons (e.g. if you cut a polygon in half, the result should be two polygons).

Can you please create a JS Fiddle that shows the problem? I'd love get to the bottom of this.

@codeofsumit codeofsumit self-requested a review December 1, 2017 01:24
@jpknapp
Copy link
Contributor Author

jpknapp commented Dec 1, 2017

http://jsfiddle.net/2odogvrr/
if you cut a single hole in the middle of 3 overlapping polygons, 3 cut events are fired with 1, 2, and 3 resultingLayers
https://i.imgur.com/HlOpr7w.png
The same thing happens if I use listeners on each individual layer.
When the cut event is fired for a layer, I only want the resulting layers from that layer (which will be 1 unless you cut the polygon in half).
I want to save the resulting layers to my database, but if multiple layers are cut in half resulting in 2 resulting layers (for each cutted layer) I cannot just loop through resultingLayers and save all those because resultingLayers includes everything from the previously fired events.
Does this make sense?
sorry, I probably should have made an issue for this first...

@codeofsumit
Copy link
Contributor

@jpknapp thanks a ton for the explanation and your effort to solve it 👏 .
I understood now, was able to reproduce and can confirm your solution works 👍

@codeofsumit codeofsumit merged commit 1b13937 into geoman-io:develop Jun 18, 2018
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