Closed fredbayle closed 1 year ago
Thanks for the bug report. The current getCenter()
implementation for Leaflet.curve gets the bounding box of the curve and then gets the center of that box. In your case, for some reason the bounding box is extending to the left. It's likely that there is a bug in the bounding box computation but further investigation is needed.
Actually, looking at your parameters more closely, there is an error in the syntax. For the H
and V
commands, a single value (either long or lat respectively) is expected but not both (see API section). The fact that the curve was drawn correctly is luck based on the implementation.
In order to resolve the issue, you can either 1) supply single values to H
or V
commands or alternatively, 2) use the L
command which expects both lat and long values.
First of all, thank you for this amazing plugin. But, I've got an issue.
I create a curve with those parameters :
"M" [-32.39851580247402, 114.31549072265626] "C" [-32.39851580247402, 114.31549072265626] [-30.751277776257812, 115.44049072265629] [-30.751277776257812, 118.18267822265626] "S" [-32.39851580247402, 122.08502197265629] [-32.39851580247402, 122.08502197265629] "V" [-37.885259175825965, 122.08502197265629] "H" [-37.885259175825965, 114.28033447265625] "V" [-32.39851580247402, -179.76654052734378] "Z"
The curve is ok, and is displayed at the wright place.
But when I call getCenter on the curve, I get those :
lat: -34.31826847604189 lng: 42.099881398415164
lat is ok, but lng is not what it should be.
I'm using a custom map with a width twice as wide as the height. My code loads an SVG file and creates layers on the fly. Here is the SVG with only the path used for the curve :
But again, the curve is displayed at the right place.
getCenter on leaflet legacy objects (L.polygon, for instance) works fine.
Thanks.