mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Make context and dropdown menus scrollable (#15127)
This PR makes context and dropdown menus scrollable, so that they don't become totally unusable when they overflow the window. Release Notes: - N/A
This commit is contained in:
parent
4e88a08ed4
commit
8501ae6a19
@ -311,7 +311,10 @@ impl Render for ContextMenu {
|
|||||||
div().occlude().elevation_2(cx).flex().flex_row().child(
|
div().occlude().elevation_2(cx).flex().flex_row().child(
|
||||||
WithRemSize::new(ui_font_size).flex().child(
|
WithRemSize::new(ui_font_size).flex().child(
|
||||||
v_flex()
|
v_flex()
|
||||||
|
.id("context-menu")
|
||||||
.min_w(px(200.))
|
.min_w(px(200.))
|
||||||
|
.max_h(vh(0.75, cx))
|
||||||
|
.overflow_y_scroll()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle)
|
||||||
.on_mouse_down_out(cx.listener(|this, _, cx| this.cancel(&menu::Cancel, cx)))
|
.on_mouse_down_out(cx.listener(|this, _, cx| this.cancel(&menu::Cancel, cx)))
|
||||||
.key_context("menu")
|
.key_context("menu")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use gpui::{ClickEvent, CursorStyle, MouseButton, View};
|
use gpui::{AnchorCorner, ClickEvent, CursorStyle, MouseButton, View};
|
||||||
|
|
||||||
use crate::{prelude::*, ContextMenu, PopoverMenu};
|
use crate::{prelude::*, ContextMenu, PopoverMenu};
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ impl RenderOnce for DropdownMenu {
|
|||||||
.full_width(self.full_width)
|
.full_width(self.full_width)
|
||||||
.menu(move |_cx| Some(self.menu.clone()))
|
.menu(move |_cx| Some(self.menu.clone()))
|
||||||
.trigger(DropdownMenuTrigger::new(self.label).full_width(self.full_width))
|
.trigger(DropdownMenuTrigger::new(self.label).full_width(self.full_width))
|
||||||
|
.attach(AnchorCorner::BottomLeft)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user