-
Notifications
You must be signed in to change notification settings - Fork 52
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
Compatibility with Leaflet.PolylineDecorator #20
Comments
Hello, Unfortunately I don't think this is possible. Bezier curves are defined by a small number of latlngs that indicate key points and from which the rest of the curve is derived. If the list of these points is supplied to PolylineDecorator, it likely will try to decorate a straight line between the points not following the curve which I don't think is desired. I'm open to suggestions if anyone has possible solutions. Thanks |
Hello, I didn't mean to use the key points: what I meant with
was to maybe extract an approximation of the curve using a finite number of points (say 100) and provide that to PolylineDecorator. I don't know if that would be possible. Thanks for your help! |
OK, thanks for the clarification. I'll try to find an algorithm that does that. |
Any update or advice related to this? Thanks! |
I'm still looking for an algorithm for sampling the points. |
@n3d1117 @khetamHamad I have implemented a new function Example usage in the context of the demo page:
The changes are on the master branch. Please let me know if you have any feedback. I intended to release a new version soon. |
First of all, thank you elfalem for helping me in this. var style = {weight:weig, opacity:weig, color: col , animate: {duration: 3000, delay: 1000}}; L.polylineDecorator(curvedPath, |
This is because polylineDecorator doesn't recognize In your code, |
Thanks @elfalem for your time. Although I ended up using a different workaround, this really looks like a great addition! |
A new release has been published. |
Hello elfalem, Sorry for re-open this issue but I used L.polylineDecorator(curvedPath.trace([0, 0.25, 0.5, 0.75, 1]),...) and have an error related to "Uncaught TypeError: Cannot read property 'length' of undefined" Best regards. |
@khetamHamad This is probably the same issue as #23. Version 0.5.2 should fix it. |
Hello, it always complains in the following line |
@khetamHamad From the code snippet, you've provided it sounds like it's related to #22.
|
The path is a groupedLayers and it is added by default in loading the map. Best. |
In that case I'm not sure I understand the code snippet you provided. Are you able to provide a minimal but complete example that illustrates the issue? |
Hello @elfalem I'm having an undesired behavior when adding an arrowHead to a Curve. Depending on the zoom level, the position of the arrowHead is a bit off the curve. I'm using the following, code based on the Demo:
You can also see this behavior on the demo page (http://elfalem.github.io/Leaflet.curve/). If you zoom out and then click on the Trace Curves button, you'll see that the circles are not exactly on top of the curve. Is there any solution to this? Thank you, |
Hello André, |
Thanks for the detailed steps. I'm guessing the issue is related to precision of the points because it seems to occur only when zooming in after tracing. Tracing the curves when already zoomed shows correct positions. I'm not sure how easy or difficult it is to resolve this. But I'll investigate (any assistance is appreciated). In the meantime, one workaround is to obtain the trace points when zoomed in, although I'm not sure how practical that is for your use case. |
I will also try to investigate and let you know if I find something. Unfortunately, getting the trace points on a higher zoom level is not an option for me. Thanks for your attention. |
So I have been looking at this for a while. It seems like the only possible approach that could work is computing the trace points at the highest zoom level. I've been looking into how to do that regardless of the zoom level at which the trace() command is invoked. There is a useful method |
Hello!
I'm trying to draw an arrow in the middle of a L.Curve, using Leaflet.PolylineDecorator library.
What I'd like to do is:
However PolylineDecorator only accepts L.Polyline, L.Polygon or an array of L.LatLng as a parameter.
Is there maybe any way to extract an array of latlngs from the curve and use that?
Thanks!
The text was updated successfully, but these errors were encountered: