chore: Update GPUI with AnchorCorner renamed to Corner. (#497)
Ref https://github.com/zed-industries/zed/pull/22119
This commit is contained in:
parent
24982fb78c
commit
d4819b34aa
12 changed files with 69 additions and 86 deletions
23
Cargo.lock
generated
23
Cargo.lock
generated
|
|
@ -474,7 +474,7 @@ dependencies = [
|
|||
"bitflags 2.6.0",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools 0.13.0",
|
||||
"itertools 0.11.0",
|
||||
"log",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
|
|
@ -950,7 +950,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collections"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"rustc-hash",
|
||||
]
|
||||
|
|
@ -1313,7 +1313,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "derive_refineable"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -2266,7 +2266,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gpui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"as-raw-xcb-connection",
|
||||
|
|
@ -2351,7 +2351,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "gpui_macros"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -2541,7 +2541,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "http_client"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
|
@ -3057,7 +3057,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "media"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bindgen",
|
||||
|
|
@ -4337,7 +4337,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "refineable"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"derive_refineable",
|
||||
]
|
||||
|
|
@ -4658,7 +4658,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
|
|||
[[package]]
|
||||
name = "semantic_version"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"serde",
|
||||
|
|
@ -5080,7 +5080,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
|||
[[package]]
|
||||
name = "sum_tree"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"log",
|
||||
|
|
@ -5745,7 +5745,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
|||
[[package]]
|
||||
name = "util"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0ae1603610ab6b265bdfbee7b8dbc23c5ab06edc"
|
||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#65da76c2df8887f2ff699365c95ea8205bf65861"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-fs 1.6.0",
|
||||
|
|
@ -5755,7 +5755,6 @@ dependencies = [
|
|||
"futures",
|
||||
"futures-lite 1.13.0",
|
||||
"globset",
|
||||
"itertools 0.13.0",
|
||||
"log",
|
||||
"regex",
|
||||
"rust-embed",
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ impl ListDelegate for CompanyListDelegate {
|
|||
.cloned()
|
||||
.collect();
|
||||
|
||||
Task::Ready(Some(()))
|
||||
Task::ready(())
|
||||
}
|
||||
|
||||
fn confirm(&mut self, ix: Option<usize>, cx: &mut ViewContext<List<Self>>) {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ impl StoryWorkspace {
|
|||
let theme_color_picker = cx.new_view(|cx| {
|
||||
let mut picker = ColorPicker::new("theme-color-picker", cx)
|
||||
.xsmall()
|
||||
.anchor(AnchorCorner::TopRight)
|
||||
.anchor(Corner::TopRight)
|
||||
.label("Theme Color");
|
||||
picker.set_value(cx.theme().primary, cx);
|
||||
picker
|
||||
|
|
@ -461,7 +461,7 @@ impl Render for StoryWorkspace {
|
|||
Box::new(AddPanel(DockPlacement::Bottom)),
|
||||
)
|
||||
})
|
||||
.anchor(AnchorCorner::TopRight),
|
||||
.anchor(Corner::TopRight),
|
||||
)
|
||||
.child(
|
||||
Button::new("theme-mode")
|
||||
|
|
@ -567,7 +567,7 @@ impl Render for LocaleSelector {
|
|||
Box::new(SelectLocale("zh-CN".into())),
|
||||
)
|
||||
})
|
||||
.anchor(AnchorCorner::TopRight),
|
||||
.anchor(Corner::TopRight),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -630,7 +630,7 @@ impl Render for FontSizeSelector {
|
|||
Box::new(SelectScrollbarShow(ScrollbarShow::Hover)),
|
||||
)
|
||||
})
|
||||
.anchor(AnchorCorner::TopRight),
|
||||
.anchor(Corner::TopRight),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gpui::{
|
||||
actions, div, impl_actions, px, AnchorCorner, AppContext, DismissEvent, Element, EventEmitter,
|
||||
actions, div, impl_actions, px, AppContext, Corner, DismissEvent, Element, EventEmitter,
|
||||
FocusHandle, FocusableView, InteractiveElement, IntoElement, KeyBinding, MouseButton,
|
||||
ParentElement as _, Render, SharedString, Styled as _, View, ViewContext, VisualContext,
|
||||
WindowContext,
|
||||
|
|
@ -234,7 +234,7 @@ impl Render for PopupStory {
|
|||
)
|
||||
.child(
|
||||
Popover::new("info-top-right")
|
||||
.anchor(AnchorCorner::TopRight)
|
||||
.anchor(Corner::TopRight)
|
||||
.trigger(Button::new("info-top-right").label("Top Right"))
|
||||
.content(|cx| {
|
||||
cx.new_view(|cx| {
|
||||
|
|
@ -302,7 +302,7 @@ impl Render for PopupStory {
|
|||
.child(
|
||||
Button::new("popup-menu-11112")
|
||||
.label("Scrollable Menu")
|
||||
.popup_menu_with_anchor(AnchorCorner::TopRight, move |this, _| {
|
||||
.popup_menu_with_anchor(Corner::TopRight, move |this, _| {
|
||||
let mut this = this.scrollable();
|
||||
for i in 0..100 {
|
||||
this = this.menu(
|
||||
|
|
@ -323,13 +323,13 @@ impl Render for PopupStory {
|
|||
.justify_between()
|
||||
.child(
|
||||
Popover::new("info-bottom-left")
|
||||
.anchor(AnchorCorner::BottomLeft)
|
||||
.anchor(Corner::BottomLeft)
|
||||
.trigger(Button::new("pop").label("Popup with Form").w(px(300.)))
|
||||
.content(move |_| form.clone()),
|
||||
)
|
||||
.child(
|
||||
Popover::new("info-bottom-right")
|
||||
.anchor(AnchorCorner::BottomRight)
|
||||
.anchor(Corner::BottomRight)
|
||||
.mouse_button(MouseButton::Right)
|
||||
.trigger(Button::new("pop").label("Mouse Right Click").w(px(300.)))
|
||||
.content(|cx| {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use gpui::{
|
||||
anchored, canvas, deferred, div, prelude::FluentBuilder as _, px, relative, AnchorCorner,
|
||||
AppContext, Bounds, ElementId, EventEmitter, FocusHandle, FocusableView, Hsla,
|
||||
InteractiveElement as _, IntoElement, KeyBinding, MouseButton, ParentElement, Pixels, Point,
|
||||
Render, SharedString, StatefulInteractiveElement as _, Styled, View, ViewContext,
|
||||
VisualContext,
|
||||
anchored, canvas, deferred, div, prelude::FluentBuilder as _, px, relative, AppContext, Bounds,
|
||||
Corner, ElementId, EventEmitter, FocusHandle, FocusableView, Hsla, InteractiveElement as _,
|
||||
IntoElement, KeyBinding, MouseButton, ParentElement, Pixels, Point, Render, SharedString,
|
||||
StatefulInteractiveElement as _, Styled, View, ViewContext, VisualContext,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
@ -63,7 +62,7 @@ pub struct ColorPicker {
|
|||
hovered_color: Option<Hsla>,
|
||||
label: Option<SharedString>,
|
||||
size: Size,
|
||||
anchor: AnchorCorner,
|
||||
anchor: Corner,
|
||||
color_input: View<TextInput>,
|
||||
|
||||
open: bool,
|
||||
|
|
@ -112,7 +111,7 @@ impl ColorPicker {
|
|||
hovered_color: None,
|
||||
size: Size::Medium,
|
||||
label: None,
|
||||
anchor: AnchorCorner::TopLeft,
|
||||
anchor: Corner::TopLeft,
|
||||
color_input,
|
||||
open: false,
|
||||
bounds: Bounds::default(),
|
||||
|
|
@ -149,8 +148,8 @@ impl ColorPicker {
|
|||
|
||||
/// Set the anchor corner of the color picker.
|
||||
///
|
||||
/// Default is `AnchorCorner::TopLeft`.
|
||||
pub fn anchor(mut self, anchor: AnchorCorner) -> Self {
|
||||
/// Default is `Corner::TopLeft`.
|
||||
pub fn anchor(mut self, anchor: Corner) -> Self {
|
||||
self.anchor = anchor;
|
||||
self
|
||||
}
|
||||
|
|
@ -262,13 +261,12 @@ impl ColorPicker {
|
|||
}
|
||||
|
||||
fn resolved_corner(&self, bounds: Bounds<Pixels>) -> Point<Pixels> {
|
||||
match self.anchor {
|
||||
AnchorCorner::TopLeft => AnchorCorner::BottomLeft,
|
||||
AnchorCorner::TopRight => AnchorCorner::BottomRight,
|
||||
AnchorCorner::BottomLeft => AnchorCorner::TopLeft,
|
||||
AnchorCorner::BottomRight => AnchorCorner::TopRight,
|
||||
}
|
||||
.corner(bounds)
|
||||
bounds.corner(match self.anchor {
|
||||
Corner::TopLeft => Corner::BottomLeft,
|
||||
Corner::TopRight => Corner::BottomRight,
|
||||
Corner::BottomLeft => Corner::TopLeft,
|
||||
Corner::BottomRight => Corner::TopRight,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -347,12 +345,8 @@ impl Render for ColorPicker {
|
|||
div()
|
||||
.occlude()
|
||||
.map(|this| match self.anchor {
|
||||
AnchorCorner::TopLeft | AnchorCorner::TopRight => {
|
||||
this.mt_1p5()
|
||||
}
|
||||
AnchorCorner::BottomLeft | AnchorCorner::BottomRight => {
|
||||
this.mb_1p5()
|
||||
}
|
||||
Corner::TopLeft | Corner::TopRight => this.mt_1p5(),
|
||||
Corner::BottomLeft | Corner::BottomRight => this.mb_1p5(),
|
||||
})
|
||||
.w_72()
|
||||
.overflow_hidden()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use gpui::{
|
||||
anchored, deferred, div, prelude::FluentBuilder, px, relative, AnchorCorner, AnyElement,
|
||||
anchored, deferred, div, prelude::FluentBuilder, px, relative, AnyElement, Corner,
|
||||
DismissEvent, DispatchPhase, Element, ElementId, Focusable, GlobalElementId,
|
||||
InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement, Pixels, Point,
|
||||
Position, Stateful, Style, View, ViewContext, WindowContext,
|
||||
|
|
@ -25,7 +25,7 @@ impl<E> ContextMenuExt for Focusable<E> where E: ParentElement {}
|
|||
pub struct ContextMenu {
|
||||
id: ElementId,
|
||||
menu: Option<Box<dyn Fn(PopupMenu, &mut ViewContext<PopupMenu>) -> PopupMenu + 'static>>,
|
||||
anchor: AnchorCorner,
|
||||
anchor: Corner,
|
||||
}
|
||||
|
||||
impl ContextMenu {
|
||||
|
|
@ -33,7 +33,7 @@ impl ContextMenu {
|
|||
Self {
|
||||
id: id.into(),
|
||||
menu: None,
|
||||
anchor: AnchorCorner::TopLeft,
|
||||
anchor: Corner::TopLeft,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use gpui::{
|
||||
div, prelude::FluentBuilder, px, rems, AnchorCorner, AppContext, DefiniteLength, DismissEvent,
|
||||
div, prelude::FluentBuilder, px, rems, AppContext, Corner, DefiniteLength, DismissEvent,
|
||||
DragMoveEvent, Empty, Entity, EventEmitter, FocusHandle, FocusableView,
|
||||
InteractiveElement as _, IntoElement, ParentElement, Pixels, Render, ScrollHandle,
|
||||
SharedString, StatefulInteractiveElement, Styled, View, ViewContext, VisualContext as _,
|
||||
|
|
@ -375,7 +375,7 @@ impl TabPanel {
|
|||
.menu(t!("Dock.Close"), Box::new(ClosePanel))
|
||||
})
|
||||
})
|
||||
.anchor(AnchorCorner::TopRight),
|
||||
.anchor(Corner::TopRight),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ pub trait DropdownDelegate: Sized {
|
|||
}
|
||||
|
||||
fn perform_search(&mut self, _query: &str, _cx: &mut ViewContext<Dropdown<Self>>) -> Task<()> {
|
||||
Task::Ready(Some(()))
|
||||
Task::ready(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,11 +179,9 @@ where
|
|||
}
|
||||
|
||||
fn perform_search(&mut self, query: &str, cx: &mut ViewContext<List<Self>>) -> Task<()> {
|
||||
self.dropdown
|
||||
.upgrade()
|
||||
.map_or(Task::Ready(None), |dropdown| {
|
||||
dropdown.update(cx, |_, cx| self.delegate.perform_search(query, cx))
|
||||
})
|
||||
self.dropdown.upgrade().map_or(Task::ready(()), |dropdown| {
|
||||
dropdown.update(cx, |_, cx| self.delegate.perform_search(query, cx))
|
||||
})
|
||||
}
|
||||
|
||||
fn set_selected_index(&mut self, ix: Option<usize>, _: &mut ViewContext<List<Self>>) {
|
||||
|
|
@ -284,7 +282,7 @@ impl<T: DropdownItem + Clone> DropdownDelegate for SearchableVec<T> {
|
|||
.cloned()
|
||||
.collect();
|
||||
|
||||
Task::Ready(Some(()))
|
||||
Task::ready(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub trait ListDelegate: Sized + 'static {
|
|||
/// When Query Input change, this method will be called.
|
||||
/// You can perform search here.
|
||||
fn perform_search(&mut self, query: &str, cx: &mut ViewContext<List<Self>>) -> Task<()> {
|
||||
Task::Ready(Some(()))
|
||||
Task::ready(())
|
||||
}
|
||||
|
||||
/// Return the number of items in the list.
|
||||
|
|
@ -126,7 +126,7 @@ where
|
|||
enable_scrollbar: true,
|
||||
loading: false,
|
||||
size: Size::default(),
|
||||
_search_task: Task::Ready(None),
|
||||
_search_task: Task::ready(()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
actions, anchored, deferred, div, prelude::FluentBuilder as _, px, AnchorCorner, AnyElement,
|
||||
AppContext, Bounds, DismissEvent, DispatchPhase, Element, ElementId, EventEmitter, FocusHandle,
|
||||
actions, anchored, deferred, div, prelude::FluentBuilder as _, px, AnyElement, AppContext,
|
||||
Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, EventEmitter, FocusHandle,
|
||||
FocusableView, GlobalElementId, Hitbox, InteractiveElement as _, IntoElement, KeyBinding,
|
||||
LayoutId, ManagedView, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Render,
|
||||
Style, StyleRefinement, Styled, View, ViewContext, VisualContext, WindowContext,
|
||||
|
|
@ -64,7 +64,7 @@ impl Render for PopoverContent {
|
|||
|
||||
pub struct Popover<M: ManagedView> {
|
||||
id: ElementId,
|
||||
anchor: AnchorCorner,
|
||||
anchor: Corner,
|
||||
trigger: Option<Box<dyn FnOnce(bool, &WindowContext) -> AnyElement + 'static>>,
|
||||
content: Option<Rc<dyn Fn(&mut WindowContext) -> View<M> + 'static>>,
|
||||
/// Style for trigger element.
|
||||
|
|
@ -82,7 +82,7 @@ where
|
|||
pub fn new(id: impl Into<ElementId>) -> Self {
|
||||
Self {
|
||||
id: id.into(),
|
||||
anchor: AnchorCorner::TopLeft,
|
||||
anchor: Corner::TopLeft,
|
||||
trigger: None,
|
||||
trigger_style: None,
|
||||
content: None,
|
||||
|
|
@ -91,7 +91,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn anchor(mut self, anchor: AnchorCorner) -> Self {
|
||||
pub fn anchor(mut self, anchor: Corner) -> Self {
|
||||
self.anchor = anchor;
|
||||
self
|
||||
}
|
||||
|
|
@ -148,13 +148,12 @@ where
|
|||
}
|
||||
|
||||
fn resolved_corner(&self, bounds: Bounds<Pixels>) -> Point<Pixels> {
|
||||
match self.anchor {
|
||||
AnchorCorner::TopLeft => AnchorCorner::BottomLeft,
|
||||
AnchorCorner::TopRight => AnchorCorner::BottomRight,
|
||||
AnchorCorner::BottomLeft => AnchorCorner::TopLeft,
|
||||
AnchorCorner::BottomRight => AnchorCorner::TopRight,
|
||||
}
|
||||
.corner(bounds)
|
||||
bounds.corner(match self.anchor {
|
||||
Corner::TopLeft => Corner::BottomLeft,
|
||||
Corner::TopRight => Corner::BottomRight,
|
||||
Corner::BottomLeft => Corner::TopLeft,
|
||||
Corner::BottomRight => Corner::TopRight,
|
||||
})
|
||||
}
|
||||
|
||||
fn with_element_state<R>(
|
||||
|
|
@ -268,12 +267,8 @@ impl<M: ManagedView> Element for Popover<M> {
|
|||
.occlude()
|
||||
.when(!no_style, |this| this.popover_style(cx))
|
||||
.map(|this| match anchor {
|
||||
AnchorCorner::TopLeft | AnchorCorner::TopRight => {
|
||||
this.top_1p5()
|
||||
}
|
||||
AnchorCorner::BottomLeft | AnchorCorner::BottomRight => {
|
||||
this.bottom_1p5()
|
||||
}
|
||||
Corner::TopLeft | Corner::TopRight => this.top_1p5(),
|
||||
Corner::BottomLeft | Corner::BottomRight => this.bottom_1p5(),
|
||||
})
|
||||
.child(content_view.clone())
|
||||
.when(!no_style, |this| {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use gpui::{
|
|||
SharedString, View, ViewContext, VisualContext as _, WindowContext,
|
||||
};
|
||||
use gpui::{
|
||||
anchored, canvas, rems, AnchorCorner, AnyElement, Bounds, Edges, FocusableView, Keystroke,
|
||||
anchored, canvas, rems, AnyElement, Bounds, Corner, Edges, FocusableView, Keystroke,
|
||||
ScrollHandle, StatefulInteractiveElement, Styled, WeakView,
|
||||
};
|
||||
|
||||
|
|
@ -37,13 +37,13 @@ pub trait PopupMenuExt: Styled + Selectable + IntoElement + 'static {
|
|||
self,
|
||||
f: impl Fn(PopupMenu, &mut ViewContext<PopupMenu>) -> PopupMenu + 'static,
|
||||
) -> Popover<PopupMenu> {
|
||||
self.popup_menu_with_anchor(AnchorCorner::TopLeft, f)
|
||||
self.popup_menu_with_anchor(Corner::TopLeft, f)
|
||||
}
|
||||
|
||||
/// Create a popup menu with the given items, anchored to the given corner
|
||||
fn popup_menu_with_anchor(
|
||||
mut self,
|
||||
anchor: impl Into<AnchorCorner>,
|
||||
anchor: impl Into<Corner>,
|
||||
f: impl Fn(PopupMenu, &mut ViewContext<PopupMenu>) -> PopupMenu + 'static,
|
||||
) -> Popover<PopupMenu> {
|
||||
let style = self.style().clone();
|
||||
|
|
@ -649,13 +649,10 @@ impl Render for PopupMenu {
|
|||
- bounds.origin.x
|
||||
< max_width
|
||||
{
|
||||
(
|
||||
AnchorCorner::TopRight,
|
||||
-px(15.),
|
||||
)
|
||||
(Corner::TopRight, -px(15.))
|
||||
} else {
|
||||
(
|
||||
AnchorCorner::TopLeft,
|
||||
Corner::TopLeft,
|
||||
bounds.size.width
|
||||
- px(10.),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ impl Element for VirtualList {
|
|||
|
||||
let padded_bounds = Bounds::from_corners(
|
||||
bounds.origin + point(border.left + padding.left, border.top + padding.top),
|
||||
bounds.lower_right()
|
||||
bounds.bottom_right()
|
||||
- point(border.right + padding.right, border.bottom + padding.bottom),
|
||||
);
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ impl Element for VirtualList {
|
|||
|
||||
let padded_bounds = Bounds::from_corners(
|
||||
bounds.origin + point(border.left + padding.left, border.top),
|
||||
bounds.lower_right() - point(border.right + padding.right, border.bottom),
|
||||
bounds.bottom_right() - point(border.right + padding.right, border.bottom),
|
||||
);
|
||||
|
||||
if self.items_count > 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue