Skip to content

Commit

Permalink
Add text::Wrapping support
Browse files Browse the repository at this point in the history
  • Loading branch information
edwloef committed Sep 7, 2024
1 parent 8c0f4c1 commit 774ea94
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 34 deletions.
49 changes: 25 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/widget/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ use iced::{
alignment::{Horizontal, Vertical},
event,
mouse::{self, Cursor},
touch, Alignment, Border, Color, Element, Event, Length, Padding, Pixels, Point, Rectangle,
Shadow, Size, Vector,
touch,
widget::text::Wrapping,
Alignment, Border, Color, Element, Event, Length, Padding, Pixels, Point, Rectangle, Shadow,
Size, Vector,
};

pub use crate::style::{
Expand Down Expand Up @@ -841,6 +843,7 @@ fn draw_head<Message, Theme, Renderer>(
vertical_alignment: Vertical::Center,
line_height: LineHeight::Relative(1.3),
shaping: iced::advanced::text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(close_bounds.center_x(), close_bounds.center_y()),
style.close_color,
Expand Down
4 changes: 3 additions & 1 deletion src/widget/number_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use iced::{
event, keyboard,
mouse::{self, Cursor},
widget::{
text::LineHeight,
text::{LineHeight, Wrapping},
text_input::{self, cursor, Value},
Column, Container, Row, Text,
},
Expand Down Expand Up @@ -752,6 +752,7 @@ where
vertical_alignment: Vertical::Center,
line_height: LineHeight::Relative(1.3),
shaping: iced::advanced::text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(dec_bounds.center_x(), dec_bounds.center_y()),
decrease_btn_style.icon_color,
Expand Down Expand Up @@ -786,6 +787,7 @@ where
vertical_alignment: Vertical::Center,
line_height: LineHeight::Relative(1.3),
shaping: iced::advanced::text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(inc_bounds.center_x(), inc_bounds.center_y()),
increase_btn_style.icon_color,
Expand Down
6 changes: 5 additions & 1 deletion src/widget/overlay/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use iced::{
touch,
widget::{
canvas::{self, LineCap, Path, Stroke},
text, Button, Column, Row,
text::{self, Wrapping},
Button, Column, Row,
},
Alignment, Border, Color, Element, Event, Length, Padding, Pixels, Point, Rectangle, Renderer,
Shadow, Size, Vector,
Expand Down Expand Up @@ -1427,6 +1428,7 @@ fn rgba_color(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(
label_layout.bounds().center_x(),
Expand Down Expand Up @@ -1510,6 +1512,7 @@ fn rgba_color(
vertical_alignment: Vertical::Center,
line_height: iced::widget::text::LineHeight::Relative(1.3),
shaping: iced::widget::text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(
value_layout.bounds().center_x(),
Expand Down Expand Up @@ -1651,6 +1654,7 @@ fn hex_text(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(bounds.center_x(), bounds.center_y()),
Color {
Expand Down
10 changes: 9 additions & 1 deletion src/widget/overlay/date_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ use iced::{
keyboard,
mouse::{self, Cursor},
touch,
widget::{text, Button, Column, Container, Row, Text},
widget::{
text::{self, Wrapping},
Button, Column, Container, Row, Text,
},
Alignment,
Border,
Color,
Expand Down Expand Up @@ -1170,6 +1173,7 @@ fn month_year(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(left_bounds.center_x(), left_bounds.center_y()),
style
Expand All @@ -1190,6 +1194,7 @@ fn month_year(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(center_bounds.center_x(), center_bounds.center_y()),
style
Expand All @@ -1210,6 +1215,7 @@ fn month_year(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(right_bounds.center_x(), right_bounds.center_y()),
style
Expand Down Expand Up @@ -1279,6 +1285,7 @@ fn day_labels(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(bounds.center_x(), bounds.center_y()),
style
Expand Down Expand Up @@ -1371,6 +1378,7 @@ fn day_table(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(bounds.center_x(), bounds.center_y()),
if is_in_month == IsInMonth::Same {
Expand Down
10 changes: 9 additions & 1 deletion src/widget/overlay/time_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ use iced::{
widget::{
button,
canvas::{self, LineCap, Path, Stroke, Text as CanvasText},
container, text, Button, Column, Container, Row,
container,
text::{self, Wrapping},
Button, Column, Container, Row,
},
Alignment,
Border,
Expand Down Expand Up @@ -1481,6 +1483,7 @@ fn draw_digital_clock<Message, Theme>(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(up_bounds.center_x(), up_bounds.center_y()),
style
Expand All @@ -1501,6 +1504,7 @@ fn draw_digital_clock<Message, Theme>(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(center_bounds.center_x(), center_bounds.center_y()),
style
Expand All @@ -1524,6 +1528,7 @@ fn draw_digital_clock<Message, Theme>(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(down_bounds.center_x(), down_bounds.center_y()),
style
Expand Down Expand Up @@ -1575,6 +1580,7 @@ fn draw_digital_clock<Message, Theme>(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(
hour_minute_separator.bounds().center_x(),
Expand Down Expand Up @@ -1613,6 +1619,7 @@ fn draw_digital_clock<Message, Theme>(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(
minute_second_separator.bounds().center_x(),
Expand Down Expand Up @@ -1653,6 +1660,7 @@ fn draw_digital_clock<Message, Theme>(
vertical_alignment: Vertical::Center,
line_height: text::LineHeight::Relative(1.3),
shaping: text::Shaping::Basic,
wrapping: Wrapping::default(),
},
Point::new(period.bounds().center_x(), period.bounds().center_y()),
style[&StyleState::Active].text_color,
Expand Down
3 changes: 2 additions & 1 deletion src/widget/selection_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use iced::{
mouse::{self, Cursor},
widget::{
container, scrollable,
text::{self, LineHeight},
text::{self, LineHeight, Wrapping},
Container, Scrollable,
},
Border, Element, Event, Font, Length, Padding, Pixels, Rectangle, Shadow, Size,
Expand Down Expand Up @@ -229,6 +229,7 @@ where
horizontal_alignment: Horizontal::Left,
vertical_alignment: Vertical::Top,
shaping: text::Shaping::Advanced,
wrapping: Wrapping::default(),
};

state.values[id].update(text);
Expand Down
3 changes: 2 additions & 1 deletion src/widget/selection_list/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use iced::{
event,
mouse::{self, Cursor},
touch,
widget::text::LineHeight,
widget::text::{LineHeight, Wrapping},
Border, Color, Element, Event, Length, Padding, Pixels, Point, Rectangle, Shadow, Size,
};
use std::{
Expand Down Expand Up @@ -277,6 +277,7 @@ where
vertical_alignment: Vertical::Center,
line_height: LineHeight::default(),
shaping: iced::widget::text::Shaping::Advanced,
wrapping: Wrapping::default(),
},
Point::new(bounds.x, bounds.center_y()),
text_color,
Expand Down
Loading

0 comments on commit 774ea94

Please sign in to comment.