summaryrefslogtreecommitdiffstats
path: root/graphics/src/widget/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-09-20 15:54:19 +0700
committerLibravatar GitHub <noreply@github.com>2021-09-20 15:54:19 +0700
commit35c4ad6dd950fa91d181f4d3253fcb486bcf1b11 (patch)
tree8420a91cd319a63b1ed257a6334453a1a673bdfb /graphics/src/widget/text.rs
parent456a3f15e4226cc781a8825bddaaf066476d4351 (diff)
parenta0ad3996225601aaa1ebe051cba115374b55c80e (diff)
downloadiced-35c4ad6dd950fa91d181f4d3253fcb486bcf1b11.tar.gz
iced-35c4ad6dd950fa91d181f4d3253fcb486bcf1b11.tar.bz2
iced-35c4ad6dd950fa91d181f4d3253fcb486bcf1b11.zip
Merge pull request #1044 from tarkah/feature/align-fill-variant
Add Align::Fill variant
Diffstat (limited to 'graphics/src/widget/text.rs')
-rw-r--r--graphics/src/widget/text.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/graphics/src/widget/text.rs b/graphics/src/widget/text.rs
index 645c8414..d6d446d3 100644
--- a/graphics/src/widget/text.rs
+++ b/graphics/src/widget/text.rs
@@ -1,11 +1,10 @@
//! Write some text for your users to read.
use crate::backend::{self, Backend};
use crate::{Primitive, Renderer};
+use iced_native::alignment;
use iced_native::mouse;
use iced_native::text;
-use iced_native::{
- Color, Font, HorizontalAlignment, Point, Rectangle, Size, VerticalAlignment,
-};
+use iced_native::{Color, Font, Point, Rectangle, Size};
/// A paragraph of text.
///
@@ -62,19 +61,19 @@ where
size: u16,
font: Font,
color: Option<Color>,
- horizontal_alignment: HorizontalAlignment,
- vertical_alignment: VerticalAlignment,
+ horizontal_alignment: alignment::Horizontal,
+ vertical_alignment: alignment::Vertical,
) -> Self::Output {
let x = match horizontal_alignment {
- iced_native::HorizontalAlignment::Left => bounds.x,
- iced_native::HorizontalAlignment::Center => bounds.center_x(),
- iced_native::HorizontalAlignment::Right => bounds.x + bounds.width,
+ alignment::Horizontal::Left => bounds.x,
+ alignment::Horizontal::Center => bounds.center_x(),
+ alignment::Horizontal::Right => bounds.x + bounds.width,
};
let y = match vertical_alignment {
- iced_native::VerticalAlignment::Top => bounds.y,
- iced_native::VerticalAlignment::Center => bounds.center_y(),
- iced_native::VerticalAlignment::Bottom => bounds.y + bounds.height,
+ alignment::Vertical::Top => bounds.y,
+ alignment::Vertical::Center => bounds.center_y(),
+ alignment::Vertical::Bottom => bounds.y + bounds.height,
};
(