Repository navigation
Fix MapLibre layer manager slider width and style panel spacing #1415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10630,7 +10630,10 @@ def build_layer_controls(self) -> None: | |||||||||
| checkbox = widgets.Checkbox( | ||||||||||
| value=visible, description=name, style=style, indent=False | ||||||||||
| ) | ||||||||||
| checkbox.layout.flex = "1 1 auto" | ||||||||||
| # Use a zero flex basis so the checkbox only takes the space left | ||||||||||
| # over by the slider and buttons. With an "auto" basis, its default | ||||||||||
| # 300px width squeezes the opacity slider down to its minimum. | ||||||||||
| checkbox.layout.flex = "1 1 0" | ||||||||||
| checkbox.layout.min_width = "0" | ||||||||||
| checkbox.layout.overflow = "hidden" | ||||||||||
|
|
||||||||||
|
|
@@ -10642,9 +10645,9 @@ def build_layer_controls(self) -> None: | |||||||||
| readout=False, | ||||||||||
| tooltip="Change layer opacity", | ||||||||||
| layout=widgets.Layout( | ||||||||||
| flex="0 1 90px", | ||||||||||
| flex="0 0 auto", | ||||||||||
| width="90px", | ||||||||||
| min_width="40px", | ||||||||||
| min_width="90px", | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Low-confidence concern: the slider is now rigid (
Suggested change
|
||||||||||
| padding=padding, | ||||||||||
| ), | ||||||||||
| ) | ||||||||||
|
|
@@ -11019,7 +11022,8 @@ def __init__( | |||||||||
| layout=widgets.Layout(width="auto"), | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| self.output_widget = widgets.Output() | ||||||||||
| # No margin so the empty output area adds no space below the buttons. | ||||||||||
| self.output_widget = widgets.Output(layout=widgets.Layout(margin="0")) | ||||||||||
|
|
||||||||||
| # Button container | ||||||||||
| self.button_box = widgets.HBox([self.apply_btn, self.reset_btn, self.close_btn]) | ||||||||||
|
|
@@ -11029,8 +11033,10 @@ def __init__( | |||||||||
| self.reset_btn.on_click(self._reset_style) | ||||||||||
| self.close_btn.on_click(self._close_widget) | ||||||||||
|
|
||||||||||
| # Layout | ||||||||||
| self.layout = widgets.Layout(width="300px", padding="10px") | ||||||||||
| # Layout. No padding: the sidebar panel already pads its content, and | ||||||||||
| # extra padding leaves a gap below the buttons and misaligns the | ||||||||||
| # content with the other panels. | ||||||||||
| self.layout = widgets.Layout(width="300px", padding="0") | ||||||||||
|
|
||||||||||
| # Combine all widgets | ||||||||||
| self.children = [*self.style_widgets, self.button_box, self.output_widget] | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low confidence: the slider is now rigid (
flex: 0 0 auto,min_width: 90px), and the checkbox hasmin_width=0andoverflow=hiddenwith a zero basis. In a narrow sidebar, or with long layer names, the checkbox label shrinks to nothing and gets clipped, and the slider never gives up space. Before this change the slider could shrink to 40px. Consider keeping a small shrink allowance, for exampleflex="0 1 90px"withmin_width="60px". Alternatively, give the checkbox a modestmin_widthso labels stay readable.