Spaces:
Sleeping
Sleeping
Update pages/app.py
Browse files- pages/app.py +20 -11
pages/app.py
CHANGED
|
@@ -19,15 +19,16 @@ import _common_m as common
|
|
| 19 |
|
| 20 |
@solara.component
|
| 21 |
def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
| 22 |
-
species
|
| 23 |
-
dropped
|
| 24 |
-
show_full
|
| 25 |
-
show_range
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
m = solara.use_memo(
|
| 32 |
lambda: common.create_m_map(
|
| 33 |
species,
|
|
@@ -37,6 +38,7 @@ def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
|
| 37 |
dropped,
|
| 38 |
show_full,
|
| 39 |
show_range=show_range,
|
|
|
|
| 40 |
basemap=selected_bm
|
| 41 |
),
|
| 42 |
dependencies=[
|
|
@@ -47,6 +49,7 @@ def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
|
| 47 |
dropped,
|
| 48 |
show_full,
|
| 49 |
show_range,
|
|
|
|
| 50 |
selected_bm
|
| 51 |
],
|
| 52 |
)
|
|
@@ -97,6 +100,10 @@ def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
|
| 97 |
|
| 98 |
# Map Toggles
|
| 99 |
with solara.Row(style={"gap": "8px", "align-items": "center"}):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
solara.Checkbox(
|
| 101 |
label="Species range",
|
| 102 |
value=common.show_species_range,
|
|
@@ -117,7 +124,7 @@ def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
|
| 117 |
style={"font-size": "0.76em", "color": "#888", "font-style": "italic", "flex-shrink": "0"},
|
| 118 |
)
|
| 119 |
|
| 120 |
-
# Click info panel
|
| 121 |
solara.HTML(unsafe_innerHTML=f"""
|
| 122 |
<div style="
|
| 123 |
background: #f5f5f5;
|
|
@@ -128,10 +135,12 @@ def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
|
| 128 |
line-height: 1.7em;
|
| 129 |
min-height: 40px;
|
| 130 |
flex-shrink: 0;
|
|
|
|
|
|
|
| 131 |
">{click_info}</div>
|
| 132 |
""")
|
| 133 |
|
| 134 |
-
# Map widget
|
| 135 |
with solara.Column(style={
|
| 136 |
"flex": "1",
|
| 137 |
"min-height": "0",
|
|
|
|
| 19 |
|
| 20 |
@solara.component
|
| 21 |
def MainMapPanel(eco_color_map: dict, btype: str, season: str):
|
| 22 |
+
species = common.selected_species.value
|
| 23 |
+
dropped = tuple(sorted(common.dropped_ecoregions.value))
|
| 24 |
+
show_full = common.show_full_ecoregions.value
|
| 25 |
+
show_range = common.show_species_range.value
|
| 26 |
+
show_occurrences = common.show_occurrences.value
|
| 27 |
+
mode = common.map_interaction_mode.value
|
| 28 |
+
click_info = common.clicked_ecoregion.value
|
| 29 |
+
selected_bm = common.basemap_name.value
|
| 30 |
+
|
| 31 |
+
# Pass all toggles into the function and add them to dependencies
|
| 32 |
m = solara.use_memo(
|
| 33 |
lambda: common.create_m_map(
|
| 34 |
species,
|
|
|
|
| 38 |
dropped,
|
| 39 |
show_full,
|
| 40 |
show_range=show_range,
|
| 41 |
+
show_occurrences=show_occurrences,
|
| 42 |
basemap=selected_bm
|
| 43 |
),
|
| 44 |
dependencies=[
|
|
|
|
| 49 |
dropped,
|
| 50 |
show_full,
|
| 51 |
show_range,
|
| 52 |
+
show_occurrences,
|
| 53 |
selected_bm
|
| 54 |
],
|
| 55 |
)
|
|
|
|
| 100 |
|
| 101 |
# Map Toggles
|
| 102 |
with solara.Row(style={"gap": "8px", "align-items": "center"}):
|
| 103 |
+
solara.Checkbox(
|
| 104 |
+
label="Occurrences",
|
| 105 |
+
value=common.show_occurrences,
|
| 106 |
+
)
|
| 107 |
solara.Checkbox(
|
| 108 |
label="Species range",
|
| 109 |
value=common.show_species_range,
|
|
|
|
| 124 |
style={"font-size": "0.76em", "color": "#888", "font-style": "italic", "flex-shrink": "0"},
|
| 125 |
)
|
| 126 |
|
| 127 |
+
# Click info panel (z-index applied to stay above the map)
|
| 128 |
solara.HTML(unsafe_innerHTML=f"""
|
| 129 |
<div style="
|
| 130 |
background: #f5f5f5;
|
|
|
|
| 135 |
line-height: 1.7em;
|
| 136 |
min-height: 40px;
|
| 137 |
flex-shrink: 0;
|
| 138 |
+
position: relative;
|
| 139 |
+
z-index: 10;
|
| 140 |
">{click_info}</div>
|
| 141 |
""")
|
| 142 |
|
| 143 |
+
# Map widget (z-index and overflow applied to prevent it from covering the toolbar)
|
| 144 |
with solara.Column(style={
|
| 145 |
"flex": "1",
|
| 146 |
"min-height": "0",
|