Skip to content

Commit

Permalink
Rename renderer_factory to renderer in python
Browse files Browse the repository at this point in the history
  • Loading branch information
lopezvoliver committed Jul 11, 2024
1 parent 65b1fbf commit 4b0320d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions python/ipyleaflet/ipyleaflet/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ class VectorTileLayer(Layer):
Opacity of the layer between 0. (fully transparent) and 1. (fully opaque).
visible: boolean, default True
Whether the layer is visible or not.
renderer_factory: string, default 'svg'
renderer: string, default 'svg'
Engine for rendering VectorTileLayers; either 'canvas' or 'svg'. Use 'svg' for interactive layers.
interactive: boolean, default False
Whether the layer is interactive or not.
Expand All @@ -1132,7 +1132,7 @@ class VectorTileLayer(Layer):
max_zoom = Int(18).tag(sync=True, o=True)
min_native_zoom = Int(default_value=None, allow_none=True).tag(sync=True, o=True)
max_native_zoom = Int(default_value=None, allow_none=True).tag(sync=True, o=True)
renderer_factory = Unicode('svg').tag(sync=True, o=True)
renderer = Unicode('svg').tag(sync=True, o=True)
get_feature_id = Unicode(allow_none=True, default_value=None).tag(sync=True, o=True)
feature_style = Dict().tag(sync=True)

Expand Down
15 changes: 8 additions & 7 deletions python/jupyter_leaflet/src/layers/VectorTileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class LeafletVectorTileLayerModel extends LeafletLayerModel {
interactive: false,
visible: true,
opacity: 1.0,
renderer_factory: 'svg',
rendererFactory: L.svg.tile,
get_feature_id: null,
};
}
Expand All @@ -41,12 +41,13 @@ export class LeafletVectorTileLayerView extends LeafletLayerView {
};
}

let r: any = options['rendererFactory'];

if (r === 'canvas') {
options['rendererFactory'] = L.canvas.tile;
} else {
options['rendererFactory'] = L.svg.tile;
if ('renderer' in options) {
let r: any = options['renderer'];
if (r === 'canvas') {
options['rendererFactory'] = L.canvas.tile;
} else {
options['rendererFactory'] = L.svg.tile;
}
}

if ('layerStyles' in options) {
Expand Down

0 comments on commit 4b0320d

Please sign in to comment.