Skip to content

Commit

Permalink
feat: fix issue with zoom reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronan committed Jun 5, 2024
1 parent 76880a8 commit a44f7be
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/callbacks/display_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def update_download_link(slider_value, alert_data, media_url):
"""
alert_data, data_loaded = read_stored_DataFrame(alert_data)
if data_loaded and len(alert_data):
event_id, media_id = alert_data.iloc[slider_value][["event_id", "media_id"]]
event_id, media_id = alert_data.iloc[slider_value][["event_id", "media_id"]] # BUG ? IndexError: single positional indexer is out-of-bounds
if str(event_id) in media_url.keys():
return media_url[str(event_id)][str(media_id)]
return "" # Return empty string if no image URL is available
Expand Down Expand Up @@ -529,3 +529,15 @@ def toggle_fullscreen_map(n_clicks_open, is_open):
if n_clicks_open:
return not is_open # Toggle the modal
return is_open # Keep the current state


# Define the callback to reset the zoom level
@app.callback(
Output("map", "zoom"),
[Input({"type": "event-button", "index": ALL}, "n_clicks"),]
)
def reset_zoom(n_clicks):
print("ON RESET LE ZOOM")
if n_clicks:
return 10 # Reset zoom level to 10
return dash.no_update

0 comments on commit a44f7be

Please sign in to comment.