Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions leafmap/maplibregl.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ def create_container(
v.Container: The created container widget with the map and sidebar.
"""

# Use regular container sidebar

if sidebar_visible is None:
sidebar_visible = self.sidebar_args.get("sidebar_visible", False)
if min_width is None:
Expand All @@ -340,6 +342,29 @@ def create_container(
)
self.container = container
self.container.sidebar_widgets["Layers"] = self.layer_manager

if self.add_floating_sidebar_flag:
# Use floating sidebar
if self.floating_sidebar_widget is not None:
widget = self.floating_sidebar_widget
else:
sidebar_visible = self.sidebar_args.get("sidebar_visible", False)
expanded = self.sidebar_args.get("expanded", True)
position = self.sidebar_args.get("position", "top-left")
width = self.sidebar_args.get("width", "370px")
max_height = self.sidebar_args.get("max_height", "80vh")
sidebar_content = self.sidebar_args.get("sidebar_content", None)
Comment on lines +351 to +356
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter extraction logic is duplicated between the floating sidebar path and the regular sidebar path (lines 347-349). Consider extracting this common parameter retrieval logic into a helper method to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.

widget = self.add_floating_sidebar(
position=position,
width=width,
max_height=max_height,
expanded=expanded,
sidebar_visible=sidebar_visible,
sidebar_content=sidebar_content,
)
self.floating_sidebar_widget = widget

return container

def _repr_html_(self, **kwargs: Any) -> None:
Expand Down