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
SVGOverlay supports getLatLng/setLatLng methods for Tooltip/Popup bound. #7773
Comments
Thanks for taking the time to open an issue!
Steps to reproduce
Expected behavior Current behavior Environment
Additional context Minimal example reproducing the issue Please create an example using https://leafletjs.com/edit.html or any other jsfiddle-like site.
|
const svg = new L.SVGOverlay(bounds).bindPopup('some words');
// later
svg.openPopup(); // This will throw an error.
svg.openPopup(L.latlng(0, 0)); // This works well.
My solution: const MySvgOverlay = L.SVGOverlay.extend({
getLatLng() {
return computesCenterLatLng();
}
}) as any; |
Sample: https://plnkr.co/edit/KIHCpqTs1JDRyTZZ Stacktrace:
|
In my actual project, I use SVGOverlay to display an object needing tooltip support. But I found that tooltip tries accessing SVGOverlay method
getLatLng
which is not there. There is justgetLatLngBounds
method for those layers owning a region on map. But I hope even these layers would havegetLatLng
method which returns the center coordinates, or top/bottom/left/right border line's middle coordinates by an option given by users.For
setLatLng
, it's function is to move the layer without changing the size of it.The text was updated successfully, but these errors were encountered: