Fix the selected state for the panel icons in the status bar (#3450)
This PR fixes a bug where the selected state for the panel icons in the status bar was not correctly reflecting whether the panel was open. It was erroneously using the `is_open` state for the context menu. Release Notes: - N/A
This commit is contained in:
parent
b357ae4dc3
commit
04bbd107c1
2 changed files with 14 additions and 6 deletions
|
@ -14,6 +14,12 @@ impl Render for IconButtonStory {
|
||||||
.child(Story::title_for::<IconButton>())
|
.child(Story::title_for::<IconButton>())
|
||||||
.child(Story::label("Default"))
|
.child(Story::label("Default"))
|
||||||
.child(div().w_8().child(IconButton::new("icon_a", Icon::Hash)))
|
.child(div().w_8().child(IconButton::new("icon_a", Icon::Hash)))
|
||||||
|
.child(Story::label("Selected"))
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.w_8()
|
||||||
|
.child(IconButton::new("icon_a", Icon::Hash).selected(true)),
|
||||||
|
)
|
||||||
.child(Story::label("With `on_click`"))
|
.child(Story::label("With `on_click`"))
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
|
|
|
@ -701,11 +701,6 @@ impl Render for PanelButtons {
|
||||||
(action, name.into())
|
(action, name.into())
|
||||||
};
|
};
|
||||||
|
|
||||||
let button = IconButton::new(name, icon)
|
|
||||||
.selected(is_active_button)
|
|
||||||
.action(action.boxed_clone())
|
|
||||||
.tooltip(move |cx| Tooltip::for_action(tooltip.clone(), &*action, cx));
|
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
menu_handle(name)
|
menu_handle(name)
|
||||||
.menu(move |cx| {
|
.menu(move |cx| {
|
||||||
|
@ -731,7 +726,14 @@ impl Render for PanelButtons {
|
||||||
})
|
})
|
||||||
.anchor(menu_anchor)
|
.anchor(menu_anchor)
|
||||||
.attach(menu_attach)
|
.attach(menu_attach)
|
||||||
.child(|is_open| button.selected(is_open)),
|
.child(move |_is_open| {
|
||||||
|
IconButton::new(name, icon)
|
||||||
|
.selected(is_active_button)
|
||||||
|
.action(action.boxed_clone())
|
||||||
|
.tooltip(move |cx| {
|
||||||
|
Tooltip::for_action(tooltip.clone(), &*action, cx)
|
||||||
|
})
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue