Skip to content

4.0.0

Choose a tag to compare

@cdauth cdauth released this 04 Mar 19:37
· 11 commits to main since this release

Since v1.1.0, Leaflet.HighlightableLayers generates one renderer per layer and applies opacity to the renderer instead of the layer. This way the main path can cover its outline properly (if the main path itself was translucent, its outline would shine through and distort the colours).

Leaflet.HighlightableLayers 4.0.0 slightly changes this behaviour: Rather than one renderer per layer, there is now one renderer per opacity and pane. This means that different layers that are rendered on the same pane and have the same opacity are now rendered and made translucent as a group. Previously, the outline of whichever layer happened to be on top covered other layers. Now, the layers themselves are always on top of outlines, not just their own but also the outlines of other layers. This improves the look when multiple paths are connected to each other.

Have a look at this comparison:
image
The screenshot contains 3 polylines that are connected to each other. In the Leaflet.HighlightableLayers 3.0.1 on the left, some strange dots can be seen where the polylines touch each other, as the end of one line shines through the translucent end of another, and the outline of one line covers the end of the other. In Leaflet.HighlightableLayers 4.0.0 on the right, all layers are rendered as a group by the same renderer, so they look like one continuous line.

As a breaking change, the renderer parameter is not passed to the generateStyles option anymore. Returning no renderer will use the default renderer as described above now. You can still the new behaviour by returning a custom renderer there (for example one that you create through map._createRenderer({ pane }), as Leaflet.HighlightableLayers previously did.

You can read more about the new renderer behaviour in the new renderer section of the README.