Skip to main content

Positioning

Enum Positioning 

Source
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  BottomEnd

Variants§

§

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

Source

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.
Source

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.
Source

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
Source

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

Source§

fn clone(&self) -> Positioning

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Positioning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Positioning

Source§

fn default() -> Positioning

Returns the “default value” for a type. Read more
Source§

impl Copy for Positioning

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Source§

impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Source§

impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Source§

impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Source§

impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Source§

impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Source§

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<El, T, Marker> IntoElementMaybeSignal<T, Marker> for El
where El: IntoElementMaybeSignalType<T, Marker>, Marker: ?Sized,

Source§

impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
where T: From<Js> + Clone,

Source§

impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for El
where El: IntoElementsMaybeSignalType<T, Marker>, Marker: ?Sized,

Source§

impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
where T: From<Js> + Clone,

Source§

impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Source§

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Source§

impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Source§

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Source§

impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Source§

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Source§

impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Source§

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Source§

impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Source§

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Source§

impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Source§

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Source§

impl<T> SerializableKey for T

Source§

fn ser_key(&self) -> String

Serializes the key to a unique string. Read more
Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T