Skip to content

Commit

Permalink
Get map zoom (#39)
Browse files Browse the repository at this point in the history
* Get map zoom

* Bump version
  • Loading branch information
blackary authored Mar 17, 2022
1 parent 207964d commit 98362ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="streamlit_folium",
version="0.6.2",
version="0.6.3",
author="Randy Zwitch",
author_email="[email protected]",
description="Render Folium objects in Streamlit",
Expand Down
4 changes: 4 additions & 0 deletions streamlit_folium/frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type GlobalData = {
last_active_drawing: any,
all_drawings: any,
bounds: any;
zoom: any;
};

declare var __GLOBAL_DATA__: GlobalData;
Expand Down Expand Up @@ -40,12 +41,14 @@ function onRender(event: Event): void {
const global_data = __GLOBAL_DATA__;
let map = global_data.map;
let bounds = map.getBounds();
let zoom = map.getZoom();
Streamlit.setComponentValue({
last_clicked: global_data.lat_lng_clicked,
last_object_clicked: global_data.last_object_clicked,
all_drawings: global_data.all_drawings,
last_active_drawing: global_data.last_active_drawing,
bounds: bounds,
zoom: zoom,
})
}

Expand Down Expand Up @@ -105,6 +108,7 @@ function onRender(event: Event): void {
last_object_clicked: null,
all_drawings: null,
last_active_drawing: null,
zoom: null,
};`;
let replaced = fig + set_global_data;
render_script.innerHTML = replaced;
Expand Down

0 comments on commit 98362ca

Please sign in to comment.