Skip to content

Commit e5f12e1

Browse files
committed
use new alignment methods from iced
!fixup use new alignment methods from iced
1 parent a6faf72 commit e5f12e1

File tree

9 files changed

+166
-166
lines changed

9 files changed

+166
-166
lines changed

Cargo.lock

+122-121
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/style/menu_bar.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,26 @@ impl std::default::Default for Style {
3434
Self {
3535
bar_background: Color::from([0.85; 3]).into(),
3636
bar_border: Border {
37-
radius: [8.0; 4].into(),
37+
radius: 8.0.into(),
3838
..Default::default()
3939
},
4040
bar_shadow: Shadow::default(),
41-
bar_background_expand: [5; 4].into(),
41+
bar_background_expand: 5.into(),
4242

4343
menu_background: Color::from([0.85; 3]).into(),
4444
menu_border: Border {
45-
radius: [8.0; 4].into(),
45+
radius: 8.0.into(),
4646
..Default::default()
4747
},
4848
menu_shadow: Shadow {
4949
color: Color::from([0.0, 0.0, 0.0, 0.5]),
5050
offset: Vector::ZERO,
5151
blur_radius: 10.0,
5252
},
53-
menu_background_expand: [5; 4].into(),
53+
menu_background_expand: 5.into(),
5454
path: Color::from([0.3; 3]).into(),
5555
path_border: Border {
56-
radius: [6.0; 4].into(),
56+
radius: 6.0.into(),
5757
..Default::default()
5858
},
5959
}

src/widgets/menu/menu_tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ where
226226

227227
let offset_bounds = Rectangle::new(offset_position, offset_size);
228228
let children_bounds = Rectangle::new(children_position, children_size);
229-
let check_bounds = pad_rectangle(children_bounds, [check_bounds_width; 4].into());
229+
let check_bounds = pad_rectangle(children_bounds, check_bounds_width.into());
230230

231231
let menu_state = tree.state.downcast_mut::<MenuState>();
232232

src/widgets/overlay/color_picker.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use iced::{
2121
widget::{self, tree::Tree},
2222
Clipboard, Layout, Overlay, Renderer as _, Shell, Text, Widget,
2323
},
24-
alignment::{self, Horizontal, Vertical},
24+
alignment::{Horizontal, Vertical},
2525
event,
2626
keyboard,
2727
mouse::{self, Cursor},
@@ -109,15 +109,15 @@ where
109109
state: overlay_state,
110110
cancel_button: Button::new(
111111
iced::widget::Text::new(icon_to_string(Bootstrap::X))
112-
.horizontal_alignment(alignment::Horizontal::Center)
112+
.align_x(Horizontal::Center)
113113
.width(Length::Fill)
114114
.font(crate::BOOTSTRAP_FONT),
115115
)
116116
.width(Length::Fill)
117117
.on_press(on_cancel.clone()),
118118
submit_button: Button::new(
119119
iced::widget::Text::new(icon_to_string(Bootstrap::Check))
120-
.horizontal_alignment(alignment::Horizontal::Center)
120+
.align_x(Horizontal::Center)
121121
.width(Length::Fill)
122122
.font(crate::BOOTSTRAP_FONT),
123123
)
@@ -972,14 +972,14 @@ where
972972
for _ in 0..4 {
973973
rgba_colors = rgba_colors.push(
974974
Row::new()
975-
.align_items(Alignment::Center)
975+
.align_y(Alignment::Center)
976976
.spacing(SPACING)
977977
.padding(PADDING)
978978
.height(Length::Fill)
979979
.push(
980980
widget::Text::new("X:")
981-
.horizontal_alignment(Horizontal::Center)
982-
.vertical_alignment(Vertical::Center),
981+
.align_x(Horizontal::Center)
982+
.align_y(Vertical::Center),
983983
)
984984
.push(
985985
Row::new()
@@ -988,8 +988,8 @@ where
988988
)
989989
.push(
990990
widget::Text::new("XXX")
991-
.horizontal_alignment(Horizontal::Center)
992-
.vertical_alignment(Vertical::Center),
991+
.align_x(Horizontal::Center)
992+
.align_y(Vertical::Center),
993993
),
994994
);
995995
}

src/widgets/overlay/date_picker.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ where
107107
text::Text::new(icon_to_string(Bootstrap::X))
108108
.font(crate::BOOTSTRAP_FONT)
109109
.size(font_size)
110-
.horizontal_alignment(Horizontal::Center)
110+
.align_x(Horizontal::Center)
111111
.width(Length::Fill),
112112
)
113113
.width(Length::Fill)
@@ -116,7 +116,7 @@ where
116116
text::Text::new(icon_to_string(Bootstrap::Check))
117117
.font(crate::BOOTSTRAP_FONT)
118118
.size(font_size)
119-
.horizontal_alignment(Horizontal::Center)
119+
.align_x(Horizontal::Center)
120120
.width(Length::Fill),
121121
)
122122
.width(Length::Fill)
@@ -399,7 +399,7 @@ where
399399
Row::new()
400400
.width(Length::Shrink)
401401
.spacing(SPACING)
402-
.align_items(Alignment::Center)
402+
.align_y(Alignment::Center)
403403
.push(
404404
// Left Month arrow
405405
Container::new(
@@ -429,7 +429,7 @@ where
429429
Row::new()
430430
.width(Length::Shrink)
431431
.spacing(SPACING)
432-
.align_items(Alignment::Center)
432+
.align_y(Alignment::Center)
433433
.push(
434434
// Left Year arrow
435435
Container::new(
@@ -483,7 +483,7 @@ where
483483

484484
let col = Column::<Message, Theme, Renderer>::new()
485485
.spacing(SPACING)
486-
.align_items(Alignment::Center)
486+
.align_x(Alignment::Center)
487487
.push(month_year)
488488
.push(days);
489489

@@ -948,14 +948,14 @@ where
948948
cancel_button: Button::new(
949949
text::Text::new(icon_to_string(Bootstrap::X))
950950
.font(BOOTSTRAP_FONT)
951-
.horizontal_alignment(Horizontal::Center)
951+
.align_x(Horizontal::Center)
952952
.width(Length::Fill),
953953
)
954954
.into(),
955955
submit_button: Button::new(
956956
text::Text::new(icon_to_string(Bootstrap::Check))
957957
.font(BOOTSTRAP_FONT)
958-
.horizontal_alignment(Horizontal::Center)
958+
.align_x(Horizontal::Center)
959959
.width(Length::Fill),
960960
)
961961
.into(),

src/widgets/overlay/time_picker.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ where
115115
cancel_button: Button::new(
116116
text::Text::new(icon_to_string(Bootstrap::X))
117117
.font(BOOTSTRAP_FONT)
118-
.horizontal_alignment(Horizontal::Center)
118+
.align_x(Horizontal::Center)
119119
.width(Length::Fill),
120120
)
121121
.width(Length::Fill)
122122
.on_press(on_cancel.clone()),
123123
submit_button: Button::new(
124124
text::Text::new(icon_to_string(Bootstrap::Check))
125125
.font(BOOTSTRAP_FONT)
126-
.horizontal_alignment(Horizontal::Center)
126+
.align_x(Horizontal::Center)
127127
.width(Length::Fill),
128128
)
129129
.width(Length::Fill)
@@ -969,7 +969,7 @@ where
969969
let font_size = 1.2 * renderer.default_size().0;
970970

971971
let mut digital_clock_row = Row::<Message, Theme, Renderer>::new()
972-
.align_items(Alignment::Center)
972+
.align_y(Alignment::Center)
973973
.height(Length::Shrink)
974974
.width(Length::Shrink)
975975
.spacing(1);
@@ -986,7 +986,7 @@ where
986986
.push(
987987
// Hour
988988
Column::new()
989-
.align_items(Alignment::Center)
989+
.align_x(Alignment::Center)
990990
.height(Length::Shrink)
991991
.push(
992992
// Up Hour arrow
@@ -1012,7 +1012,7 @@ where
10121012
)
10131013
.push(
10141014
Column::new()
1015-
.align_items(Alignment::Center)
1015+
.align_x(Alignment::Center)
10161016
.height(Length::Shrink)
10171017
.push(
10181018
// Up Minute arrow
@@ -1041,7 +1041,7 @@ where
10411041
)
10421042
.push(
10431043
Column::new()
1044-
.align_items(Alignment::Center)
1044+
.align_x(Alignment::Center)
10451045
.height(Length::Shrink)
10461046
.push(
10471047
// Up Minute arrow
@@ -1733,14 +1733,14 @@ where
17331733
cancel_button: Button::new(
17341734
text::Text::new(icon_to_string(Bootstrap::X))
17351735
.font(BOOTSTRAP_FONT)
1736-
.horizontal_alignment(Horizontal::Center)
1736+
.align_x(Horizontal::Center)
17371737
.width(Length::Fill),
17381738
)
17391739
.into(),
17401740
submit_button: Button::new(
17411741
text::Text::new(icon_to_string(Bootstrap::Check))
17421742
.font(BOOTSTRAP_FONT)
1743-
.horizontal_alignment(Horizontal::Center)
1743+
.align_x(Horizontal::Center)
17441744
.width(Length::Fill),
17451745
)
17461746
.into(),

src/widgets/quad.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ impl Default for Quad {
5050
quad_border: Border {
5151
color: Color::TRANSPARENT,
5252
width: 0.0,
53-
radius: [0.0, 0.0, 0.0, 0.0].into(),
53+
radius: 0.0.into(),
5454
},
5555
quad_shadow: Shadow::default(),
5656

5757
bg_color: None,
5858
bg_border: Border {
5959
color: Color::TRANSPARENT,
6060
width: 0.0,
61-
radius: [0.0, 0.0, 0.0, 0.0].into(),
61+
radius: 0.0.into(),
6262
},
6363
bg_shadow: Shadow::default(),
6464
}

src/widgets/slide_bar.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ where
3434
/// Background color of the bar
3535
pub background: Option<Color>,
3636
/// Border radius of the bar
37-
pub border_radius: [f32; 4],
37+
pub border_radius: f32,
3838
/// Border width of the bar
3939
pub border_width: f32,
4040
/// Border color of the bar
@@ -85,7 +85,7 @@ where
8585
height: None,
8686
color: Color::from([0.5; 3]),
8787
background: None,
88-
border_radius: [5.0; 4],
88+
border_radius: 5.0,
8989
border_width: 1.0,
9090
border_color: Color::BLACK,
9191
step: T::from(1),

src/widgets/tab_bar.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ where
376376
Text::<Theme, Renderer>::new(icon.to_string())
377377
.size(size)
378378
.font(font.unwrap_or_default())
379-
.horizontal_alignment(alignment::Horizontal::Center)
380-
.vertical_alignment(alignment::Vertical::Center)
379+
.align_x(alignment::Horizontal::Center)
380+
// .align_y(alignment::Horizontal::Center)
381381
.shaping(iced::advanced::text::Shaping::Advanced)
382382
.width(Length::Shrink)
383383
}
@@ -395,8 +395,7 @@ where
395395
Text::<Theme, Renderer>::new(text)
396396
.size(size)
397397
.font(font.unwrap_or_default())
398-
.horizontal_alignment(alignment::Horizontal::Center)
399-
.vertical_alignment(alignment::Vertical::Center)
398+
.align_x(alignment::Horizontal::Center)
400399
.shaping(text::Shaping::Advanced)
401400
.width(Length::Shrink)
402401
}
@@ -409,16 +408,16 @@ where
409408
.push(
410409
match tab_label {
411410
TabLabel::Icon(icon) => Column::new()
412-
.align_items(Alignment::Center)
411+
.align_x(Alignment::Center)
413412
.push(layout_icon(icon, self.icon_size + 1.0, self.font)),
414413

415414
TabLabel::Text(text) => Column::new()
416415
.padding(5.0)
417-
.align_items(Alignment::Center)
416+
.align_x(Alignment::Center)
418417
.push(layout_text(text, self.text_size + 1.0, self.text_font)),
419418

420419
TabLabel::IconText(icon, text) => {
421-
let mut column = Column::new().align_items(Alignment::Center);
420+
let mut column = Column::new().align_x(Alignment::Center);
422421

423422
match self.position {
424423
Position::Top => {
@@ -437,7 +436,7 @@ where
437436
Position::Right => {
438437
column = column.push(
439438
Row::new()
440-
.align_items(Alignment::Center)
439+
.align_y(Alignment::Center)
441440
.push(layout_text(
442441
text,
443442
self.text_size + 1.0,
@@ -453,7 +452,7 @@ where
453452
Position::Left => {
454453
column = column.push(
455454
Row::new()
456-
.align_items(Alignment::Center)
455+
.align_y(Alignment::Center)
457456
.push(layout_icon(
458457
icon,
459458
self.icon_size + 1.0,
@@ -487,7 +486,7 @@ where
487486
.width(self.tab_width)
488487
.height(self.height),
489488
)
490-
.align_items(Alignment::Center)
489+
.align_y(Alignment::Center)
491490
.padding(self.padding)
492491
.width(self.tab_width);
493492

@@ -496,7 +495,7 @@ where
496495
Row::new()
497496
.width(Length::Fixed(self.close_size * 1.3 + 1.0))
498497
.height(Length::Fixed(self.close_size * 1.3 + 1.0))
499-
.align_items(Alignment::Center),
498+
.align_y(Alignment::Center),
500499
);
501500
}
502501

@@ -505,7 +504,7 @@ where
505504
.width(self.width)
506505
.height(self.height)
507506
.spacing(self.spacing)
508-
.align_items(Alignment::Center);
507+
.align_y(Alignment::Center);
509508

510509
let element: Element<Message, Theme, Renderer> = Element::new(row);
511510
let tab_tree = if let Some(child_tree) = tree.children.get_mut(0) {

0 commit comments

Comments
 (0)