dock: Use disabled instead of hiding the zoom menu (#949)
This commit is contained in:
parent
ed6adc2dae
commit
2febe2611b
2 changed files with 8 additions and 7 deletions
|
|
@ -19,7 +19,7 @@ UI components for building fantastic desktop applications using [GPUI](https://g
|
||||||
|
|
||||||
Here is the first application: [Longbridge Pro](https://longbridge.com/desktop), built using GPUI Component.
|
Here is the first application: [Longbridge Pro](https://longbridge.com/desktop), built using GPUI Component.
|
||||||
|
|
||||||
<img width="1763" alt="Image" src="https://wp-cdn.4ce.cn/v2/hZRGaJm.png" />
|
<img width="1763" alt="Image" src="https://assets.lbctrl.com/uploads/32c11b27-b90d-4fce-a6b8-7d72e99fb231/longbridge-pro.png" />
|
||||||
|
|
||||||
We built multi-theme support in the application. This feature is not included in GPUI Component itself, but is based on the `Theme` feature, so it's easy to implement.
|
We built multi-theme support in the application. This feature is not included in GPUI Component itself, but is based on the `Theme` feature, so it's easy to implement.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,6 @@ impl TabPanel {
|
||||||
let view = cx.entity().clone();
|
let view = cx.entity().clone();
|
||||||
let zoomable_toolbar_visible = state.zoomable.map_or(false, |v| v.toolbar_visible());
|
let zoomable_toolbar_visible = state.zoomable.map_or(false, |v| v.toolbar_visible());
|
||||||
|
|
||||||
// TODO: Do not show MenuButton if there is no menu items
|
|
||||||
h_flex()
|
h_flex()
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.occlude()
|
.occlude()
|
||||||
|
|
@ -466,14 +465,16 @@ impl TabPanel {
|
||||||
move |this, window, cx| {
|
move |this, window, cx| {
|
||||||
view.read(cx)
|
view.read(cx)
|
||||||
.popup_menu(this, window, cx)
|
.popup_menu(this, window, cx)
|
||||||
.when(zoomable, |this| {
|
.separator()
|
||||||
let name = if zoomed {
|
.menu_with_disabled(
|
||||||
|
if zoomed {
|
||||||
t!("Dock.Zoom Out")
|
t!("Dock.Zoom Out")
|
||||||
} else {
|
} else {
|
||||||
t!("Dock.Zoom In")
|
t!("Dock.Zoom In")
|
||||||
};
|
},
|
||||||
this.separator().menu(name, Box::new(ToggleZoom))
|
Box::new(ToggleZoom),
|
||||||
})
|
!zoomable,
|
||||||
|
)
|
||||||
.when(closable, |this| {
|
.when(closable, |this| {
|
||||||
this.separator()
|
this.separator()
|
||||||
.menu(t!("Dock.Close"), Box::new(ClosePanel))
|
.menu(t!("Dock.Close"), Box::new(ClosePanel))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue