#[non_exhaustive]pub struct WindowPositioner {
pub anchor: WindowAnchor,
pub anchor_rect: (Position, Size),
pub offset: Position,
pub gravity: WindowGravity,
pub constraint_adjustment: WindowConstraintAdjustment,
}Expand description
The positioner state backing a window’s anchor-based placement.
Set at window creation via WindowAttributes::with_positioner, and read/mutated at runtime
through Window::positioner/Window::set_positioner. See those methods for
platform-specific behavior, and WindowPositioner::default for the values used when
WindowAttributes::with_positioner is never called.
The structure is based on the wayland structure. For more information see the wayland documentation XDG Positioner
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.anchor: WindowAnchorThe edge or corner of the anchor rect used to position the window relative to it.
Combined with gravity, this controls which corner/edge of the anchor
rectangle the window is pinned to. Defaults to WindowAnchor::Center.
anchor_rect: (Position, Size)The anchor rectangle the window is positioned relative to.
The Position is the top-left corner of the rectangle relative to the parent window’s
content area, and the Size its dimensions. Defaults to a 1x1 rectangle at the
content origin. Passing a WindowPositioner to WindowAttributes::with_positioner
overrides the position value set with WindowAttributes::with_position.
offset: PositionThe window’s position relative to the anchor rect. Defaults to no offset.
gravity: WindowGravityThe direction the window surface extends away from the anchor point.
Combined with anchor, this determines the final position of the window
relative to its anchor rectangle. Defaults to WindowGravity::Center.
constraint_adjustment: WindowConstraintAdjustmentHow the window should be repositioned when it would be constrained.
The flags in WindowConstraintAdjustment can be combined to allow sliding, flipping,
and/or resizing the window independently on each axis. Defaults to no adjustment.
Implementations§
Source§impl WindowPositioner
impl WindowPositioner
pub fn new( anchor: WindowAnchor, anchor_rect: (Position, Size), offset: Position, gravity: WindowGravity, constraint_adjustment: WindowConstraintAdjustment, ) -> Self
Trait Implementations§
Source§impl Clone for WindowPositioner
impl Clone for WindowPositioner
Source§fn clone(&self) -> WindowPositioner
fn clone(&self) -> WindowPositioner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more