Refactor alignment types into an alignment module
This commit is contained in:
parent
5fae6e59ff
commit
a0ad399622
54 changed files with 402 additions and 377 deletions
|
|
@ -7,8 +7,9 @@ use iced_graphics::backend;
|
|||
use iced_graphics::font;
|
||||
use iced_graphics::layer::Layer;
|
||||
use iced_graphics::{Primitive, Viewport};
|
||||
use iced_native::alignment;
|
||||
use iced_native::mouse;
|
||||
use iced_native::{Font, HorizontalAlignment, Size, VerticalAlignment};
|
||||
use iced_native::{Font, Size};
|
||||
|
||||
#[cfg(any(feature = "image_rs", feature = "svg"))]
|
||||
use crate::image;
|
||||
|
|
@ -207,24 +208,24 @@ impl Backend {
|
|||
}],
|
||||
layout: wgpu_glyph::Layout::default()
|
||||
.h_align(match text.horizontal_alignment {
|
||||
HorizontalAlignment::Left => {
|
||||
alignment::Horizontal::Left => {
|
||||
wgpu_glyph::HorizontalAlign::Left
|
||||
}
|
||||
HorizontalAlignment::Center => {
|
||||
alignment::Horizontal::Center => {
|
||||
wgpu_glyph::HorizontalAlign::Center
|
||||
}
|
||||
HorizontalAlignment::Right => {
|
||||
alignment::Horizontal::Right => {
|
||||
wgpu_glyph::HorizontalAlign::Right
|
||||
}
|
||||
})
|
||||
.v_align(match text.vertical_alignment {
|
||||
VerticalAlignment::Top => {
|
||||
alignment::Vertical::Top => {
|
||||
wgpu_glyph::VerticalAlign::Top
|
||||
}
|
||||
VerticalAlignment::Center => {
|
||||
alignment::Vertical::Center => {
|
||||
wgpu_glyph::VerticalAlign::Center
|
||||
}
|
||||
VerticalAlignment::Bottom => {
|
||||
alignment::Vertical::Bottom => {
|
||||
wgpu_glyph::VerticalAlign::Bottom
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue