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
dashArray: "none" in canvas renderer leaks context state between layers #6367
Comments
Hi, Thank you for using Leaflet. Please can you provide a Plunker that reproduces that issue, without any wrapper library? |
With a bit of digging, I found what the issue is! https://next.plnkr.co/edit/hhRnU8AT3rQQMvBt Somewhere in our code, we're passing This is easily fixable from our end by simply not passing invalid values to dashArray. However this could still be considered a bug because this canvas and SVG render inconsistently for the same value of dashArray. PS: I found another issue (unrelated?), where the dashArray wouldn't work if I omitted the commas i.e. |
Thank you for your investigation! 👍 As for the issue with space-separated values, see #6277 (fix should be in Leaflet 1.3.4) |
I confirm that exiting |
How to reproduce
react-leaflet
What behaviour I'm expecting and which behaviour I'm seeing
I currently run into a situation with Canvas renderer where my polylines and polygons are not rendered with the correct
dashArray
. Sometimes lines with a specifieddashArray
are rendered without one and lines without one are rendered with one. I wish I could reproduce this with a small example but I can't seem to figure out how to reproduce it exactly (I'm usingreact-leaflet
1.1.4 for what it's worth).What seems to be happening is that the settings in
Leaflet/src/layer/vector/Canvas.js
Lines 314 to 334 in da6f20d
are being leaked between successive calls. From what I can tell, Canvas renderer attempts to isolate the state between calls in
_draw
usingctx.save()
andctx.restore()
. However in my application, multiple calls tofillStroke
are made in a single_draw
call (which is called exactly once per map update). If I usectx.save()
andctx.restore()
in_fillStroke
, the problem goes awayThe text was updated successfully, but these errors were encountered: