-
Notifications
You must be signed in to change notification settings - Fork 335
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
Circle drawn on the hit marker does not disappear when cancelling #293
Comments
Maybe is it to late: hideMarkerOnCollapse does the job. leaflet-search/src/leaflet-search.js Line 903 in e5573af
to if(self._markerSearch && title != "") { |
Thank you. I fixed the problem already but to tell the truth, I don't remember how... |
I tested it again with my application, not that it is a special case. ... |
Hello. I have this same issue when i zoom, the circle just appears again. Couldn't fix the problem with what was suggested. Im currently using leaflet 1.9.3 and leaflet-search 3.0.9 Thanks for the help. |
I don't remember what I did specifically that the circle is now gone. Maybe this: markerSearchControl.on("search:cancel", function(e) {
if (e.target.options.hideMarkerOnCollapse) {
//console.log(e.target._map);
e.target._map.removeLayer(this._markerSearch);
}
}); |
Hello, thanks for answering! Unfortunately those lines of code did not solve my problem. I think I have found the source. leaflet-search/src/leaflet-search.js Line 901 in e5573af
The "once" listener has 2 types: moveend and zoomend. In previous versions of leaflet, if one or the other is executed, the listener is removed when the function finishes executing. For the current version, both events must be executed to remove the listener. This causes the markers to be added again when zooming. I don't know if this is intentional or a bug. For now I have solved the issue by removing the zoomend event from the listener. You can try with this example and see two logs in your console (latest leaflet version).
I hope this information is useful. And excuse my spelling mistakes. Greetings. |
Hi,
I use the marker.circle option. When I click on the cancel icon in the search box, the circle stays on the map, even with the option 'hideMarkerOnCollapse: true'.
However, when I make another research, the circle correctly disappears.
Is there a way to fix this ?
THank you,
Olivier
The text was updated successfully, but these errors were encountered: