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

Fix bug when circle is the only layer on the map #627

Merged
merged 4 commits into from
Sep 3, 2020

Conversation

Falke-Design
Copy link
Collaborator

@Falke-Design Falke-Design commented Jul 9, 2020

When circle was the only layer on the map, the hidden snapping-border circle was making problems while edit mode.

Fix: #640
Fix: #652

@codeofsumit
Copy link
Contributor

This seems to be quite custom.
Couldn’t we utilize pmTempLayer For this?

https://github.com/Falke-Design/leaflet.pm/blob/circle_bug/src/js/Mixins/Snapping.js#L264

Maybe I misunderstand the problem here - can you explain it more?

@Falke-Design
Copy link
Collaborator Author

No because of the line from you, the snapping will not work on _pmTempLayer layers. So I can't use this flag for the hidden Circle, where I want to snap.

So when I have one Circle on the map and I edit them, then a hidden Circle for snapping to the borders is created. Because of this new hidden layer, the available snapping layers is greater then 1. Then a snapList will be created.
But in the function _calcClosestLayer the snapping to the own circle border from the "parent" circle is not allowed Snapping.js#L282. Now no other layer is on the map where can be snapped, so Snapping.js#L277 will returned empty and then it runs in _checkPrioritiySnapping() into a empty object and crashs Snapping.js#L171.

When more then one Circle is drawn on the map, there will never returned an empty Object.

@codeofsumit codeofsumit merged commit 0954f68 into geoman-io:develop Sep 3, 2020
@Falke-Design Falke-Design deleted the circle_bug branch November 11, 2020 20:41
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