pub struct PositionSizeConfig {
pub origin_position: [f32; 2],
pub origin_size: [f32; 2],
pub x_location_grid: [f32; 2],
pub y_location_grid: [f32; 2],
pub x_size_grid: [f32; 2],
pub y_size_grid: [f32; 2],
pub display_method: (HorizontalAlign, VerticalAlign),
pub offset: [f32; 2],
}Expand description
Config for positioning and sizing resources in a flexible grid system.
用于在灵活的网格系统中定位和调整资源大小的配置。
This struct provides comprehensive control over how resources are positioned and sized within the GUI, supporting grid-based layouts with multiple alignment options.
这个结构体提供了对GUI中资源如何定位和大小的全面控制,支持具有多种对齐选项的基于网格的布局。
§Grid System 网格系统
The grid system allows for relative positioning and sizing using fractions of the available space, making layouts responsive and adaptable to different screen sizes.
网格系统允许使用可用空间的一部分进行相对定位和大小调整,使布局响应并适应不同的屏幕尺寸。
Fields§
§origin_position: [f32; 2]Absolute position coordinates in pixels ([x, y]).
以像素为单位的绝对位置坐标([x, y])。
origin_size: [f32; 2]Absolute size dimensions in pixels ([width, height]).
以像素为单位的绝对尺寸([width, height])。
x_location_grid: [f32; 2]Grid-based X-axis positioning ([numerator, denominator]).
基于网格的x轴定位([numerator, denominator])。
Position = (total_width * numerator / denominator)
位置 = (总宽度 * 分子 / 分母)
y_location_grid: [f32; 2]Grid-based Y-axis positioning ([numerator, denominator]).
基于网格的y轴定位([numerator, denominator])。
Position = (total_height * numerator / denominator)
位置 = (总高度 * 分子 / 分母)
x_size_grid: [f32; 2]Grid-based X-axis sizing ([numerator, denominator]).
基于网格的x轴缩放([numerator, denominator])。
Width = (total_width * numerator / denominator)
宽度 = (总宽度 * 分子 / 分母)
y_size_grid: [f32; 2]Grid-based Y-axis sizing ([numerator, denominator]).
基于网格的y轴缩放([numerator, denominator])。
Height = (total_height * numerator / denominator)
高度 = (总高度 * 分子 / 分母)
display_method: (HorizontalAlign, VerticalAlign)Horizontal and vertical alignment methods.
水平和垂直对齐方法。
offset: [f32; 2]Additional offset in pixels ([x_offset, y_offset]).
额外的像素偏移量([x_offset, y_offset])。
Implementations§
Source§impl PositionSizeConfig
impl PositionSizeConfig
pub fn origin_position(self, x: f32, y: f32) -> Self
pub fn origin_size(self, width: f32, height: f32) -> Self
pub fn x_size_grid(self, fetch: f32, total: f32) -> Self
pub fn y_size_grid(self, fetch: f32, total: f32) -> Self
pub fn x_location_grid(self, fetch: f32, total: f32) -> Self
pub fn y_location_grid(self, fetch: f32, total: f32) -> Self
pub fn display_method( self, horizontal_align: HorizontalAlign, vertical_align: VerticalAlign, ) -> Self
pub fn offset(self, x: f32, y: f32) -> Self
Trait Implementations§
Source§impl Clone for PositionSizeConfig
impl Clone for PositionSizeConfig
Source§fn clone(&self) -> PositionSizeConfig
fn clone(&self) -> PositionSizeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PositionSizeConfig
impl Debug for PositionSizeConfig
Source§impl Default for PositionSizeConfig
impl Default for PositionSizeConfig
Source§impl PartialEq for PositionSizeConfig
impl PartialEq for PositionSizeConfig
Source§impl PartialOrd for PositionSizeConfig
impl PartialOrd for PositionSizeConfig
impl Copy for PositionSizeConfig
impl StructuralPartialEq for PositionSizeConfig
Auto Trait Implementations§
impl Freeze for PositionSizeConfig
impl RefUnwindSafe for PositionSizeConfig
impl Send for PositionSizeConfig
impl Sync for PositionSizeConfig
impl Unpin for PositionSizeConfig
impl UnsafeUnpin for PositionSizeConfig
impl UnwindSafe for PositionSizeConfig
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().