Skip to main content

place_relative

Function place_relative 

Source
pub fn place_relative(
    parent: &LayoutRect,
    width: f32,
    height: f32,
    offset_x: f32,
    offset_y: f32,
) -> LayoutRect
Expand description

Places a block relative to its parent.

§Arguments

  • parent - Rect of the parent block.
  • width - Width of the block being placed.
  • height - Height of the block being placed.
  • offset_x - Gap to the parent’s right edge if positive, to its left edge if negative, or 0 to center it.
  • offset_y - Gap to the parent’s front edge if positive, to its back edge if negative, or 0 to center it.

§Returns

The rect of the placed block.