Skip to content

Commit 39cc5c3

Browse files
committed
Make update cyto max zoom callback to clientside
1 parent 7a77cc0 commit 39cc5c3

14 files changed

+32
-27
lines changed

dash_cytoscape/CyLeaflet.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,8 @@ def get_cytoscape_max_zoom(self, leaflet_max_zoom):
226226
Input({"id": MATCH, "component": "cyleaflet", "sub": "cy"}, "elements"),
227227
prevent_initial_call=True,
228228
)
229-
230-
231-
@callback(
232-
Output({"id": MATCH, "component": "cyleaflet", "sub": "cy"}, "maxZoom"),
233-
Input({"id": MATCH, "component": "cyleaflet", "sub": "leaf"}, "children"),
234-
)
235-
def update_cyto_max_zoom(leaf_children):
236-
if isinstance(leaf_children, list) and len(leaf_children) >= 1:
237-
tile_layer = list(filter(lambda x: x["type"] == "TileLayer", leaf_children))[0]
238-
else:
239-
tile_layer = leaf_children
240-
leaflet_max_zoom = 18
241-
if "maxZoom" in tile_layer["props"].keys():
242-
leaflet_max_zoom = tile_layer["props"]["maxZoom"]
243-
return get_cytoscape_max_zoom(leaflet_max_zoom)
229+
clientside_callback(
230+
ClientsideFunction(namespace="cyleaflet", function_name="updateCytoMaxZoom"),
231+
Output({"id": MATCH, "component": "cyleaflet", "sub": "cy"}, "maxZoom"),
232+
Input({"id": MATCH, "component": "cyleaflet", "sub": "leaf"}, "children"),
233+
)

dash_cytoscape/dash_cytoscape.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape_extra.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape_extra.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/dash_cytoscape.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/dash_cytoscape.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/dash_cytoscape_extra.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/dash_cytoscape_extra.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/deps/dash_cytoscape.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)