pub enum Positioning {
Top,
TopStart,
TopEnd,
Right,
RightStart,
RightEnd,
Bottom,
BottomStart,
BottomEnd,
Left,
LeftStart,
LeftEnd,
}Expand description
Specifies where content should be positioned relative to a trigger element.
Each variant places the content along one of the four edges of the trigger,
with optional alignment (Start / End) along the perpendicular axis.
When no alignment suffix is given, the content is centered along that edge.
TopStart Top TopEnd
┌─────────────────┐
LeftStart │ │ RightStart
Left │ trigger │ Right
LeftEnd │ │ RightEnd
└─────────────────┘
BottomStart Bottom BottomEndVariants§
Top
Centered above the trigger.
TopStart
Above the trigger, aligned to the start (left) edge.
TopEnd
Above the trigger, aligned to the end (right) edge.
Right
Centered to the right of the trigger.
RightStart
To the right of the trigger, aligned to the start (top) edge.
RightEnd
To the right of the trigger, aligned to the end (bottom) edge.
Bottom
Centered below the trigger.
BottomStart
Below the trigger, aligned to the start (left) edge.
BottomEnd
Below the trigger, aligned to the end (right) edge.
Left
Centered to the left of the trigger.
LeftStart
To the left of the trigger, aligned to the start (top) edge.
LeftEnd
To the left of the trigger, aligned to the end (bottom) edge.
Implementations§
Source§impl Positioning
impl Positioning
Sourcepub fn calculate_position(
self,
trigger_top: f64,
trigger_left: f64,
trigger_width: f64,
trigger_height: f64,
content_height: f64,
content_width: f64,
offset: f64,
) -> (f64, f64)
pub fn calculate_position( self, trigger_top: f64, trigger_left: f64, trigger_width: f64, trigger_height: f64, content_height: f64, content_width: f64, offset: f64, ) -> (f64, f64)
Calculate the position of content relative to a trigger element.
Returns (top, left) coordinates in pixels, suitable for use with
position: fixed CSS styling.
§Arguments
trigger_top/trigger_left– the trigger element’s viewport coordinates.trigger_width/trigger_height– the trigger element’s dimensions.content_height/content_width– the content element’s dimensions.offset– additional spacing (in pixels) between the trigger and content.
Sourcepub fn calculate_arrow_position(
self,
trigger_top: f64,
trigger_left: f64,
trigger_width: f64,
trigger_height: f64,
arrow_size: f64,
) -> (f64, f64, i32)
pub fn calculate_arrow_position( self, trigger_top: f64, trigger_left: f64, trigger_width: f64, trigger_height: f64, arrow_size: f64, ) -> (f64, f64, i32)
Calculate the position and rotation for an arrow indicator.
Returns (top, left, rotation) where top and left are pixel
coordinates and rotation is in degrees. The arrow is intended to
be a small square element rotated so that one corner points toward
the trigger.
§Arguments
trigger_top/trigger_left– the trigger element’s viewport coordinates.trigger_width/trigger_height– the trigger element’s dimensions.arrow_size– the width/height of the square arrow element in pixels.
Sourcepub fn calculate_position_style(
self,
trigger_top: f64,
trigger_left: f64,
trigger_width: f64,
trigger_height: f64,
content_height: f64,
content_width: f64,
offset: f64,
arrow_size: f64,
) -> String
pub fn calculate_position_style( self, trigger_top: f64, trigger_left: f64, trigger_width: f64, trigger_height: f64, content_height: f64, content_width: f64, offset: f64, arrow_size: f64, ) -> String
Calculate position as a CSS style attribute string including arrow CSS custom properties.
The returned string sets position: fixed, top, left, and three
CSS custom properties consumed by the arrow element:
--biji-tooltip-arrow-top--biji-tooltip-arrow-left--biji-tooltip-arrow-rotation
Sourcepub fn calculate_position_style_simple(
self,
trigger_top: f64,
trigger_left: f64,
trigger_width: f64,
trigger_height: f64,
content_height: f64,
content_width: f64,
offset: f64,
) -> String
pub fn calculate_position_style_simple( self, trigger_top: f64, trigger_left: f64, trigger_width: f64, trigger_height: f64, content_height: f64, content_width: f64, offset: f64, ) -> String
Calculate position as a simple CSS style attribute string without arrow variables.
Returns a string containing only position: fixed, top, and left.
Use this when an arrow indicator is not needed (e.g., dropdown menus).
Trait Implementations§
Source§impl Clone for Positioning
impl Clone for Positioning
Source§fn clone(&self) -> Positioning
fn clone(&self) -> Positioning
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Positioning
impl Debug for Positioning
Source§impl Default for Positioning
impl Default for Positioning
Source§fn default() -> Positioning
fn default() -> Positioning
impl Copy for Positioning
Auto Trait Implementations§
impl Freeze for Positioning
impl RefUnwindSafe for Positioning
impl Send for Positioning
impl Sync for Positioning
impl Unpin for Positioning
impl UnsafeUnpin for Positioning
impl UnwindSafe for Positioning
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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