Skip to content

Commit

Permalink
Beta to main (#260)
Browse files Browse the repository at this point in the history
!fixup use new alignment methods from iced

---------

Co-authored-by: Redhawk18 <redhawk76767676@gmail.com>
  • Loading branch information
genusistimelord and Redhawk18 authored Jul 15, 2024
1 parent 752c573 commit 7aa7e9b
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 166 deletions.
243 changes: 122 additions & 121 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/style/menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ impl std::default::Default for Style {
Self {
bar_background: Color::from([0.85; 3]).into(),
bar_border: Border {
radius: [8.0; 4].into(),
radius: 8.0.into(),
..Default::default()
},
bar_shadow: Shadow::default(),
bar_background_expand: [5; 4].into(),
bar_background_expand: 5.into(),

menu_background: Color::from([0.85; 3]).into(),
menu_border: Border {
radius: [8.0; 4].into(),
radius: 8.0.into(),
..Default::default()
},
menu_shadow: Shadow {
color: Color::from([0.0, 0.0, 0.0, 0.5]),
offset: Vector::ZERO,
blur_radius: 10.0,
},
menu_background_expand: [5; 4].into(),
menu_background_expand: 5.into(),
path: Color::from([0.3; 3]).into(),
path_border: Border {
radius: [6.0; 4].into(),
radius: 6.0.into(),
..Default::default()
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/menu/menu_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ where

let offset_bounds = Rectangle::new(offset_position, offset_size);
let children_bounds = Rectangle::new(children_position, children_size);
let check_bounds = pad_rectangle(children_bounds, [check_bounds_width; 4].into());
let check_bounds = pad_rectangle(children_bounds, check_bounds_width.into());

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

Expand Down
16 changes: 8 additions & 8 deletions src/widgets/overlay/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use iced::{
widget::{self, tree::Tree},
Clipboard, Layout, Overlay, Renderer as _, Shell, Text, Widget,
},
alignment::{self, Horizontal, Vertical},
alignment::{Horizontal, Vertical},
event,
keyboard,
mouse::{self, Cursor},
Expand Down Expand Up @@ -109,15 +109,15 @@ where
state: overlay_state,
cancel_button: Button::new(
iced::widget::Text::new(icon_to_string(Bootstrap::X))
.horizontal_alignment(alignment::Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill)
.font(crate::BOOTSTRAP_FONT),
)
.width(Length::Fill)
.on_press(on_cancel.clone()),
submit_button: Button::new(
iced::widget::Text::new(icon_to_string(Bootstrap::Check))
.horizontal_alignment(alignment::Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill)
.font(crate::BOOTSTRAP_FONT),
)
Expand Down Expand Up @@ -972,14 +972,14 @@ where
for _ in 0..4 {
rgba_colors = rgba_colors.push(
Row::new()
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.spacing(SPACING)
.padding(PADDING)
.height(Length::Fill)
.push(
widget::Text::new("X:")
.horizontal_alignment(Horizontal::Center)
.vertical_alignment(Vertical::Center),
.align_x(Horizontal::Center)
.align_y(Vertical::Center),
)
.push(
Row::new()
Expand All @@ -988,8 +988,8 @@ where
)
.push(
widget::Text::new("XXX")
.horizontal_alignment(Horizontal::Center)
.vertical_alignment(Vertical::Center),
.align_x(Horizontal::Center)
.align_y(Vertical::Center),
),
);
}
Expand Down
14 changes: 7 additions & 7 deletions src/widgets/overlay/date_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ where
text::Text::new(icon_to_string(Bootstrap::X))
.font(crate::BOOTSTRAP_FONT)
.size(font_size)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.width(Length::Fill)
Expand All @@ -116,7 +116,7 @@ where
text::Text::new(icon_to_string(Bootstrap::Check))
.font(crate::BOOTSTRAP_FONT)
.size(font_size)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.width(Length::Fill)
Expand Down Expand Up @@ -399,7 +399,7 @@ where
Row::new()
.width(Length::Shrink)
.spacing(SPACING)
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.push(
// Left Month arrow
Container::new(
Expand Down Expand Up @@ -429,7 +429,7 @@ where
Row::new()
.width(Length::Shrink)
.spacing(SPACING)
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.push(
// Left Year arrow
Container::new(
Expand Down Expand Up @@ -483,7 +483,7 @@ where

let col = Column::<Message, Theme, Renderer>::new()
.spacing(SPACING)
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.push(month_year)
.push(days);

Expand Down Expand Up @@ -948,14 +948,14 @@ where
cancel_button: Button::new(
text::Text::new(icon_to_string(Bootstrap::X))
.font(BOOTSTRAP_FONT)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.into(),
submit_button: Button::new(
text::Text::new(icon_to_string(Bootstrap::Check))
.font(BOOTSTRAP_FONT)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.into(),
Expand Down
16 changes: 8 additions & 8 deletions src/widgets/overlay/time_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ where
cancel_button: Button::new(
text::Text::new(icon_to_string(Bootstrap::X))
.font(BOOTSTRAP_FONT)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.width(Length::Fill)
.on_press(on_cancel.clone()),
submit_button: Button::new(
text::Text::new(icon_to_string(Bootstrap::Check))
.font(BOOTSTRAP_FONT)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.width(Length::Fill)
Expand Down Expand Up @@ -969,7 +969,7 @@ where
let font_size = 1.2 * renderer.default_size().0;

let mut digital_clock_row = Row::<Message, Theme, Renderer>::new()
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.height(Length::Shrink)
.width(Length::Shrink)
.spacing(1);
Expand All @@ -986,7 +986,7 @@ where
.push(
// Hour
Column::new()
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.height(Length::Shrink)
.push(
// Up Hour arrow
Expand All @@ -1012,7 +1012,7 @@ where
)
.push(
Column::new()
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.height(Length::Shrink)
.push(
// Up Minute arrow
Expand Down Expand Up @@ -1041,7 +1041,7 @@ where
)
.push(
Column::new()
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.height(Length::Shrink)
.push(
// Up Minute arrow
Expand Down Expand Up @@ -1733,14 +1733,14 @@ where
cancel_button: Button::new(
text::Text::new(icon_to_string(Bootstrap::X))
.font(BOOTSTRAP_FONT)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.into(),
submit_button: Button::new(
text::Text::new(icon_to_string(Bootstrap::Check))
.font(BOOTSTRAP_FONT)
.horizontal_alignment(Horizontal::Center)
.align_x(Horizontal::Center)
.width(Length::Fill),
)
.into(),
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/quad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ impl Default for Quad {
quad_border: Border {
color: Color::TRANSPARENT,
width: 0.0,
radius: [0.0, 0.0, 0.0, 0.0].into(),
radius: 0.0.into(),
},
quad_shadow: Shadow::default(),

bg_color: None,
bg_border: Border {
color: Color::TRANSPARENT,
width: 0.0,
radius: [0.0, 0.0, 0.0, 0.0].into(),
radius: 0.0.into(),
},
bg_shadow: Shadow::default(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/slide_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
/// Background color of the bar
pub background: Option<Color>,
/// Border radius of the bar
pub border_radius: [f32; 4],
pub border_radius: f32,
/// Border width of the bar
pub border_width: f32,
/// Border color of the bar
Expand Down Expand Up @@ -85,7 +85,7 @@ where
height: None,
color: Color::from([0.5; 3]),
background: None,
border_radius: [5.0; 4],
border_radius: 5.0,
border_width: 1.0,
border_color: Color::BLACK,
step: T::from(1),
Expand Down
23 changes: 11 additions & 12 deletions src/widgets/tab_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ where
Text::<Theme, Renderer>::new(icon.to_string())
.size(size)
.font(font.unwrap_or_default())
.horizontal_alignment(alignment::Horizontal::Center)
.vertical_alignment(alignment::Vertical::Center)
.align_x(alignment::Horizontal::Center)
// .align_y(alignment::Horizontal::Center)
.shaping(iced::advanced::text::Shaping::Advanced)
.width(Length::Shrink)
}
Expand All @@ -395,8 +395,7 @@ where
Text::<Theme, Renderer>::new(text)
.size(size)
.font(font.unwrap_or_default())
.horizontal_alignment(alignment::Horizontal::Center)
.vertical_alignment(alignment::Vertical::Center)
.align_x(alignment::Horizontal::Center)
.shaping(text::Shaping::Advanced)
.width(Length::Shrink)
}
Expand All @@ -409,16 +408,16 @@ where
.push(
match tab_label {
TabLabel::Icon(icon) => Column::new()
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.push(layout_icon(icon, self.icon_size + 1.0, self.font)),

TabLabel::Text(text) => Column::new()
.padding(5.0)
.align_items(Alignment::Center)
.align_x(Alignment::Center)
.push(layout_text(text, self.text_size + 1.0, self.text_font)),

TabLabel::IconText(icon, text) => {
let mut column = Column::new().align_items(Alignment::Center);
let mut column = Column::new().align_x(Alignment::Center);

match self.position {
Position::Top => {
Expand All @@ -437,7 +436,7 @@ where
Position::Right => {
column = column.push(
Row::new()
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.push(layout_text(
text,
self.text_size + 1.0,
Expand All @@ -453,7 +452,7 @@ where
Position::Left => {
column = column.push(
Row::new()
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.push(layout_icon(
icon,
self.icon_size + 1.0,
Expand Down Expand Up @@ -487,7 +486,7 @@ where
.width(self.tab_width)
.height(self.height),
)
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.padding(self.padding)
.width(self.tab_width);

Expand All @@ -496,7 +495,7 @@ where
Row::new()
.width(Length::Fixed(self.close_size * 1.3 + 1.0))
.height(Length::Fixed(self.close_size * 1.3 + 1.0))
.align_items(Alignment::Center),
.align_y(Alignment::Center),
);
}

Expand All @@ -505,7 +504,7 @@ where
.width(self.width)
.height(self.height)
.spacing(self.spacing)
.align_items(Alignment::Center);
.align_y(Alignment::Center);

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

0 comments on commit 7aa7e9b

Please sign in to comment.