leaflet-arrowheads icon indicating copy to clipboard operation
leaflet-arrowheads copied to clipboard

Just one `<path>` element

Open Azbesciak opened this issue 3 years ago • 2 comments

Hello, did you consider approach to provide just one <path> element instead of the separate one for every arrow? Maybe it would improve the performance because in my case I have hundred of arrows.

  • textpath even after optimization is not enough - just because of SVG, it freezes my screen.
  • Polylinedecorator is better because it at least renders and allows some interaction, but lags when I change view - same as your lib.

So I assume it is also about the elements count; the best solution would be to use webgl but, we are in leaflet. So maybe limitting the elements size is the solution? Without any arrows (just a polyline) there is no lag in my case.

Azbesciak avatar May 16 '22 11:05 Azbesciak

There is probably a lot of ways to significantly optimize leaflet-arrowheads. I'm sure its possible to do what you're saying, but I really don't have the bandwidth ATM to to that kind of overhaul. I haven't noticed any lag, but I haven't pushed the limits how how many arrows I've tried to draw. Perhaps preferCanvas would help?

I'll leave this open for awhile and think about it.

slutske22 avatar May 17 '22 05:05 slutske22

I tried some time ago prefer canvas in my app, and it did not change a lot (anything) so I even did not thnik about it. Hovever, i fetched decoratepolyline source code and added "batch" path, and the inprove is significant - a lot less object to track for example.

Azbesciak avatar May 17 '22 05:05 Azbesciak