pub struct Position { /* private fields */ }
Expand description

Represents the size, location and centerpoint of a shape. We align shapes along their center points, and have edges directed at the center. Shapes like Box and Circle have their center point in the middle, but labels have their center point in one of the sides to make sure that edges don’t obscure the text. The halo is the gap around the shape where nothing can be placed and it is applied symmetrically to the sides.

This struct has fields that represent the following points:


| _____________ | | | | | | | | | | | M <––|—|–the middle of the shape, in absolute coordinates. | | C <-|—|–the center point, saved as delta, relative to M. | |_____________| | | ^—|— the size of the shape. |____________________| <—– size + halo.

Implementations

Returns the center of the shape in absolute coordinates.

Returns the middle of the shape. (not center!)

\return True if the box fits within the x ranges of \p range.

Update the center point for the shape. This is expressed as the delta from the center of mass (middle-point).

Align the shape to the line \p x, to the right or the left, depending on \p to_left.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.