pub struct Positioner { /* private fields */ }Expand description
An unstyled element that positions its children as an anchored popup.
This owns measurement, side selection, alignment, and viewport clamping. It installs no presentation of its own and adds no wrapper element around its children.
Implementations§
Source§impl Positioner
impl Positioner
Sourcepub fn side(trigger_bounds: Bounds<Pixels>) -> Self
pub fn side(trigger_bounds: Bounds<Pixels>) -> Self
Places the popup on a side of trigger_bounds, flipping when needed.
Sourcepub fn corner(anchor: Anchor, position: Point<Pixels>) -> Self
pub fn corner(anchor: Anchor, position: Point<Pixels>) -> Self
Places anchor’s corner of the popup at position.
This is the corner-anchoring path used by triggers that were written
against GPUI’s anchored element. It clamps into the viewport without
changing the requested anchor.
Sourcepub fn placement(self, placement: Placement) -> Self
pub fn placement(self, placement: Placement) -> Self
Sets the preferred side. Only meaningful for Positioner::side.
Sourcepub fn align(self, align: Align) -> Self
pub fn align(self, align: Align) -> Self
Sets the alignment along the chosen side. Only meaningful for
Positioner::side.
Sourcepub fn offset(self, offset: Pixels) -> Self
pub fn offset(self, offset: Pixels) -> Self
Sets the gap between the trigger and the popup. Only meaningful for
Positioner::side.
Sourcepub fn occlude(self) -> Self
pub fn occlude(self) -> Self
Blocks the mouse over the positioned popup.
Off by default, because a tooltip that swallowed the pointer would un-hover the very trigger keeping it open. An interactive surface — a popover, a menu, a dropdown — wants it on: what the surface covers is the surface’s, not the panel underneath.
Trait Implementations§
Source§impl Element for Positioner
impl Element for Positioner
Source§type RequestLayoutState = PositionerState
type RequestLayoutState = PositionerState
Element::request_layout. A mutable reference to this state is subsequently
provided to Element::prepaint and Element::paint.Source§type PrepaintState = ()
type PrepaintState = ()
Element::prepaint. A mutable reference to this state is subsequently
provided to Element::paint.Source§fn id(&self) -> Option<ElementId>
fn id(&self) -> Option<ElementId>
Source§fn source_location(&self) -> Option<&'static Location<'static>>
fn source_location(&self) -> Option<&'static Location<'static>>
Source§fn request_layout(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
window: &mut Window,
cx: &mut App,
) -> (LayoutId, Self::RequestLayoutState)
fn request_layout( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, window: &mut Window, cx: &mut App, ) -> (LayoutId, Self::RequestLayoutState)
Source§fn prepaint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
bounds: Bounds<Pixels>,
request_layout: &mut Self::RequestLayoutState,
window: &mut Window,
cx: &mut App,
)
fn prepaint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, bounds: Bounds<Pixels>, request_layout: &mut Self::RequestLayoutState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn paint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
_: Bounds<Pixels>,
_: &mut Self::RequestLayoutState,
_: &mut Self::PrepaintState,
window: &mut Window,
cx: &mut App,
)
fn paint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, _: Bounds<Pixels>, _: &mut Self::RequestLayoutState, _: &mut Self::PrepaintState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn a11y_role(&self) -> Option<Role>
fn a11y_role(&self) -> Option<Role>
None are not included in the accessibility tree. Read moreSource§fn write_a11y_info(&self, _node: &mut Node)
fn write_a11y_info(&self, _node: &mut Node)
a11y_role() returns Some. Read moreSource§fn a11y_synthetic_children(
&mut self,
_prepaint: &mut Self::PrepaintState,
_builder: &mut A11ySubtreeBuilder<'_>,
)
fn a11y_synthetic_children( &mut self, _prepaint: &mut Self::PrepaintState, _builder: &mut A11ySubtreeBuilder<'_>, )
Source§fn into_any(self) -> AnyElement
fn into_any(self) -> AnyElement
AnyElement.Source§impl IntoElement for Positioner
impl IntoElement for Positioner
Source§type Element = Positioner
type Element = Positioner
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl ParentElement for Positioner
impl ParentElement for Positioner
Source§fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)
fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)
Source§fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
Source§fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl !RefUnwindSafe for Positioner
impl !Send for Positioner
impl !Sync for Positioner
impl !UnwindSafe for Positioner
impl Freeze for Positioner
impl Unpin for Positioner
impl UnsafeUnpin for Positioner
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ElementExt for Twhere
T: ParentElement,
impl<T> ElementExt for Twhere
T: ParentElement,
Source§fn text_selection_scope(self, scope: TextSelectionScopeId) -> impl IntoElementwhere
Self: IntoElement,
fn text_selection_scope(self, scope: TextSelectionScopeId) -> impl IntoElementwhere
Self: IntoElement,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more