Skip to content

Commit

Permalink
backwards compatibility for vector_tile_layer_styles
Browse files Browse the repository at this point in the history
  • Loading branch information
lopezvoliver committed Jul 12, 2024
1 parent 8376c74 commit aaf6020
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/ipyleaflet/ipyleaflet/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ class VectorTileLayer(Layer):
attribution = Unicode().tag(sync=True, o=True)

layer_styles = Union([Dict(), Unicode()]).tag(sync=True, o=True)
vector_tile_layer_styles = Union([Dict(), Unicode()], allow_none=True, default_value=None)
opacity = Float(1.0, min=0.0, max=1.0).tag(sync=True,o=True)
visible = Bool(True).tag(sync=True, o=True)
interactive = Bool(False).tag(sync=True, o=True)
Expand All @@ -1136,6 +1137,13 @@ class VectorTileLayer(Layer):
feature_id = Unicode(allow_none=True, default_value=None).tag(sync=True, o=True)
feature_style = Dict().tag(sync=True)

def __init__(self, **kwargs):
super(VectorTileLayer, self).__init__(**kwargs)
# Backwards compatibility: allow vector_tile_layer_styles as input:
vtl_style = getattr(self, "vector_tile_layer_styles")
if(vtl_style):
self.layer_styles = vtl_style

def redraw(self):
"""Force redrawing the tiles.
Expand Down

0 comments on commit aaf6020

Please sign in to comment.