diff --git a/masonry/README.md b/masonry/README.md index 108c2d688..c953c4cf6 100644 --- a/masonry/README.md +++ b/masonry/README.md @@ -133,7 +133,7 @@ pub fn make_widget_tree() -> NewWidget { let list = Flex::column() .with_fixed( NewWidget::new(Flex::row().with(text_input, 1.0).with_fixed(button)) - .with_props(PropertySet::new().with(Padding::all(WIDGET_SPACING.get()))), + .with_props(PropertySet::new().with(Padding::all(WIDGET_SPACING))), ) .with_fixed_spacer(WIDGET_SPACING); diff --git a/masonry/examples/calc_masonry.rs b/masonry/examples/calc_masonry.rs index be14fb0d5..12f310872 100644 --- a/masonry/examples/calc_masonry.rs +++ b/masonry/examples/calc_masonry.rs @@ -255,7 +255,7 @@ pub fn build_calc() -> NewWidget { NewWidget::new(root_widget).with_props( PropertySet::new() .with(Background::Color(AlphaColor::from_str("#794869").unwrap())) - .with(Padding::all(2.0)) + .with(Padding::all(2.px())) .with(Gap::new(1.px())), ) } @@ -274,7 +274,7 @@ fn custom_property_set() -> DefaultProperties { PropertySet::new() .with(Background::Color(BLUE)) .with(BorderColor::new(Color::TRANSPARENT)) - .with(BorderWidth::all(2.0)), + .with(BorderWidth::all(2.px())), ); stack.push( Selector::classes(&["op_button"]).with_active(true), @@ -285,7 +285,7 @@ fn custom_property_set() -> DefaultProperties { PropertySet::new() .with(Background::Color(GRAY)) .with(BorderColor::new(Color::TRANSPARENT)) - .with(BorderWidth::all(2.0)), + .with(BorderWidth::all(2.px())), ); stack.push( Selector::classes(&["digit_button"]).with_active(true), diff --git a/masonry/examples/gallery/badge.rs b/masonry/examples/gallery/badge.rs index b4c1a7a3d..b1f767048 100644 --- a/masonry/examples/gallery/badge.rs +++ b/masonry/examples/gallery/badge.rs @@ -6,7 +6,7 @@ use masonry::core::{ ErasedAction, Handled, NewWidget, PropertySet, StyleProperty, Widget, WidgetId, WidgetTag, }; use masonry::kurbo::Vec2; -use masonry::layout::Length; +use masonry::layout::{AsUnit, Length}; use masonry::parley::style::FontWeight; use masonry::peniko::Color; use masonry::properties::types::CrossAxisAlignment; @@ -93,7 +93,7 @@ impl DemoPage for BadgeDemo { let outline_badge = NewWidget::new(Badge::with_text("99+")).with_props( PropertySet::new() .with(Background::Color(Color::TRANSPARENT)) - .with(BorderWidth { width: 1.0 }) + .with(BorderWidth { width: 1.px() }) .with(BorderColor { color: Color::from_rgb8(0x71, 0x71, 0x7a), }), @@ -155,8 +155,8 @@ impl DemoPage for BadgeDemo { .with_props( PropertySet::new() .with(Background::Color(Color::from_rgb8(0x3f, 0x3f, 0x46))) - .with(CornerRadius { radius: 999.0 }) - .with(Padding::all(0.0)), + .with(CornerRadius { radius: 999.px() }) + .with(Padding::ZERO), ); let online_dot = NewWidget::new(Badge::new( @@ -166,9 +166,9 @@ impl DemoPage for BadgeDemo { )) .with_props( PropertySet::new() - .with(Padding::all(0.0)) - .with(CornerRadius { radius: 999.0 }) - .with(BorderWidth { width: 0.0 }) + .with(Padding::ZERO) + .with(CornerRadius { radius: 999.px() }) + .with(BorderWidth { width: 0.px() }) .with(Background::Color(Color::from_rgb8(0x22, 0xc5, 0x5e))), ); diff --git a/masonry/examples/gallery/image.rs b/masonry/examples/gallery/image.rs index 1a3025d47..aa16d8cb3 100644 --- a/masonry/examples/gallery/image.rs +++ b/masonry/examples/gallery/image.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use masonry::core::{NewWidget, PropertySet, StyleProperty, Widget}; -use masonry::layout::AsUnit as _; +use masonry::layout::AsUnit; use masonry::peniko::{ImageAlphaType, ImageData, ImageFormat}; use masonry::properties::ObjectFit; use masonry::properties::types::CrossAxisAlignment; @@ -54,7 +54,7 @@ impl DemoPage for ImageDemo { .prepare(), ) .with_fixed_spacer(CONTENT_GAP) - .with_fixed(SizedBox::new(image).size(420.0.px(), 280.0.px()).prepare()); + .with_fixed(SizedBox::new(image).size(420.px(), 280.px()).prepare()); wrap_in_shell(self.shell, NewWidget::new(body).erased()) } diff --git a/masonry/examples/gallery/kitchen_sink.rs b/masonry/examples/gallery/kitchen_sink.rs index 6bf2ff18d..9e7a29c37 100644 --- a/masonry/examples/gallery/kitchen_sink.rs +++ b/masonry/examples/gallery/kitchen_sink.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use masonry::core::{NewWidget, PropertySet, StyleProperty, Widget}; -use masonry::layout::{AsUnit as _, UnitPoint}; +use masonry::layout::{AsUnit, UnitPoint}; use masonry::peniko::Color; use masonry::properties::types::CrossAxisAlignment; use masonry::properties::{Background, Padding}; @@ -43,10 +43,10 @@ impl DemoPage for KitchenSinkDemo { let grid = NewWidget::new(SizedBox::new(grid.prepare())).with_props( PropertySet::new() .with(Background::Color(Color::from_rgb8(0x24, 0x24, 0x24))) - .with(Padding::all(12.0)), + .with(Padding::all(12.px())), ); - let bg = NewWidget::new(SizedBox::empty().size(220.0.px(), 120.0.px())).with_props( + let bg = NewWidget::new(SizedBox::empty().size(220.px(), 120.px())).with_props( PropertySet::one(Background::Color(Color::from_rgb8(0x44, 0x22, 0x66))), ); diff --git a/masonry/examples/gallery/main.rs b/masonry/examples/gallery/main.rs index beaf20028..23c373ce4 100644 --- a/masonry/examples/gallery/main.rs +++ b/masonry/examples/gallery/main.rs @@ -32,6 +32,7 @@ mod transforms; use masonry::core::{ErasedAction, NewWidget, StyleProperty, Widget as _, WidgetId, WidgetTag}; use masonry::dpi::LogicalSize; +use masonry::layout::Length; use masonry::parley::style::FontWeight; use masonry::properties::Padding; use masonry::properties::types::CrossAxisAlignment; @@ -45,11 +46,11 @@ use masonry_winit::winit::window::Window; use crate::demo::{DemoPage, new_demo_shell_tags}; use crate::switch::SwitchDemo; -const SIDEBAR_WIDTH: masonry::layout::Length = masonry::layout::Length::const_px(240.0); -const SIDEBAR_SCROLLBAR_INSET: f64 = 12.0; -const LEFT_PANE_TOP_PADDING: f64 = 12.0; -const LEFT_PANE_LEFT_PADDING: f64 = 12.0; -const RIGHT_PANE_PADDING: f64 = 12.0; +const SIDEBAR_WIDTH: Length = Length::const_px(240.0); +const SIDEBAR_SCROLLBAR_INSET: Length = Length::const_px(12.0); +const LEFT_PANE_TOP_PADDING: Length = Length::const_px(12.0); +const LEFT_PANE_LEFT_PADDING: Length = Length::const_px(12.0); +const RIGHT_PANE_PADDING: Length = Length::const_px(12.0); const DEMO_TITLE_FONT_SIZE: f32 = 20.0; @@ -222,7 +223,7 @@ fn main() { // scrollbar doesn't sit on top of the buttons. let list = NewWidget::new(SizedBox::new(list.prepare())).with_props(Padding { top: LEFT_PANE_TOP_PADDING, - bottom: 0.0, + bottom: Length::ZERO, left: LEFT_PANE_LEFT_PADDING, right: SIDEBAR_SCROLLBAR_INSET, }); diff --git a/masonry/examples/gallery/spinner.rs b/masonry/examples/gallery/spinner.rs index fafe54a0f..1048362e8 100644 --- a/masonry/examples/gallery/spinner.rs +++ b/masonry/examples/gallery/spinner.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use masonry::core::{NewWidget, Widget}; -use masonry::layout::AsUnit as _; +use masonry::layout::AsUnit; use masonry::properties::types::CrossAxisAlignment; use masonry::widgets::{Flex, SizedBox, Spinner}; @@ -32,7 +32,7 @@ impl DemoPage for SpinnerDemo { .cross_axis_alignment(CrossAxisAlignment::Center) .with_fixed( SizedBox::new(Spinner::new().prepare()) - .size(80.0.px(), 80.0.px()) + .size(80.px(), 80.px()) .prepare(), ); diff --git a/masonry/examples/gallery/split.rs b/masonry/examples/gallery/split.rs index 5a5e9ed93..142524cab 100644 --- a/masonry/examples/gallery/split.rs +++ b/masonry/examples/gallery/split.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use masonry::core::{NewWidget, PropertySet, StyleProperty, Widget}; -use masonry::layout::AsUnit as _; +use masonry::layout::AsUnit; use masonry::peniko::Color; use masonry::properties::{Background, Padding}; use masonry::widgets::{Label, SizedBox, Split}; @@ -37,7 +37,7 @@ impl DemoPage for SplitDemo { .with_props( PropertySet::new() .with(Background::Color(Color::from_rgb8(0x1f, 0x2a, 0x44))) - .with(Padding::all(12.0)), + .with(Padding::all(12.px())), ); let right = NewWidget::new(SizedBox::new( @@ -48,11 +48,11 @@ impl DemoPage for SplitDemo { .with_props( PropertySet::new() .with(Background::Color(Color::from_rgb8(0x2b, 0x3c, 0x2f))) - .with(Padding::all(12.0)), + .with(Padding::all(12.px())), ); - let body = SizedBox::new(Split::new(left, right).split_fraction(0.33).prepare()) - .height(260.0.px()); + let body = + SizedBox::new(Split::new(left, right).split_fraction(0.33).prepare()).height(260.px()); wrap_in_shell(self.shell, NewWidget::new(body).erased()) } diff --git a/masonry/examples/gallery/step_input.rs b/masonry/examples/gallery/step_input.rs index 3dad7c9f6..785af4b87 100644 --- a/masonry/examples/gallery/step_input.rs +++ b/masonry/examples/gallery/step_input.rs @@ -72,7 +72,7 @@ impl DemoPage for StepInputDemo { stack.push( Selector::new(), - (BorderWidth::all(2.), CornerRadius::all(20.)), + (BorderWidth::all(2.px()), CornerRadius::all(20.px())), ); stack.push( diff --git a/masonry/examples/gallery/transforms.rs b/masonry/examples/gallery/transforms.rs index 4a424f059..0dc94bed4 100644 --- a/masonry/examples/gallery/transforms.rs +++ b/masonry/examples/gallery/transforms.rs @@ -6,7 +6,7 @@ use masonry::core::{ ErasedAction, Handled, NewWidget, PropertySet, StyleProperty, Widget, WidgetId, WidgetTag, }; use masonry::kurbo::{Affine, Vec2}; -use masonry::layout::AsUnit as _; +use masonry::layout::AsUnit; use masonry::peniko::Color; use masonry::properties::types::CrossAxisAlignment; use masonry::properties::{Background, Padding}; @@ -108,13 +108,13 @@ impl DemoPage for TransformsDemo { .with_style(StyleProperty::FontSize(14.0)) .prepare(), ) - .size(160.0.px(), 160.0.px()), + .size(160.px(), 160.px()), ) .with_tag(self.target) .with_props( PropertySet::new() .with(Background::Color(Color::from_rgb8(0x35, 0x35, 0x35))) - .with(Padding::all(12.0)), + .with(Padding::all(12.px())), ); let body = Flex::column() diff --git a/masonry/examples/grid_masonry.rs b/masonry/examples/grid_masonry.rs index 92dd95b08..d287be9b1 100644 --- a/masonry/examples/grid_masonry.rs +++ b/masonry/examples/grid_masonry.rs @@ -11,7 +11,7 @@ use masonry::core::{ ErasedAction, NewWidget, PointerButton, PropertySet, StyleProperty, Widget as _, WidgetId, }; use masonry::dpi::LogicalSize; -use masonry::layout::Length; +use masonry::layout::{AsUnit, Length}; use masonry::peniko::Color; use masonry::properties::{BorderColor, BorderWidth, Gap}; use masonry::theme::default_property_set; @@ -69,7 +69,7 @@ pub fn make_grid(grid_gap: f64) -> NewWidget { let props = PropertySet::new() .with(BorderColor::new(Color::from_rgb8(40, 40, 80))) - .with(BorderWidth::all(1.0)); + .with(BorderWidth::all(1.px())); let label = SizedBox::new(NewWidget::new(label).with_props(props)); let button_inputs = vec![ diff --git a/masonry/examples/layers.rs b/masonry/examples/layers.rs index 5d0e72e19..3e577ba9f 100644 --- a/masonry/examples/layers.rs +++ b/masonry/examples/layers.rs @@ -178,7 +178,7 @@ fn main() { .with_props(PropertySet::one(ContentColor::new(Color::BLACK))), )) .with_props(PropertySet::from(( - BorderWidth::all(1.), + BorderWidth::all(1.px()), BorderColor::new(Color::BLACK), Background::Color(Color::WHITE), ))) diff --git a/masonry/examples/to_do_list.rs b/masonry/examples/to_do_list.rs index 5a44311d7..21947a2a5 100644 --- a/masonry/examples/to_do_list.rs +++ b/masonry/examples/to_do_list.rs @@ -77,7 +77,7 @@ pub fn make_widget_tree() -> NewWidget { let root = Flex::column() .with_fixed( NewWidget::new(Flex::row().with(text_input, 1.0).with_fixed(button)) - .with_props(PropertySet::new().with(Padding::all(WIDGET_SPACING.get()))), + .with_props(PropertySet::new().with(Padding::all(WIDGET_SPACING))), ) .with_fixed_spacer(WIDGET_SPACING) .with(portal, 1.0); diff --git a/masonry/src/lib.rs b/masonry/src/lib.rs index 57e24e869..9baf3fe54 100644 --- a/masonry/src/lib.rs +++ b/masonry/src/lib.rs @@ -103,7 +103,7 @@ //! let list = Flex::column() //! .with_fixed( //! NewWidget::new(Flex::row().with(text_input, 1.0).with_fixed(button)) -//! .with_props(PropertySet::new().with(Padding::all(WIDGET_SPACING.get()))), +//! .with_props(PropertySet::new().with(Padding::all(WIDGET_SPACING))), //! ) //! .with_fixed_spacer(WIDGET_SPACING); //! diff --git a/masonry/src/properties/slider.rs b/masonry/src/properties/slider.rs index 28f01de32..66a6eb4f6 100644 --- a/masonry/src/properties/slider.rs +++ b/masonry/src/properties/slider.rs @@ -4,16 +4,17 @@ use std::any::TypeId; use crate::core::{Property, UpdateCtx}; +use crate::layout::Length; use crate::peniko::Color; use crate::theme; -/// The thickness of a slider's track, in logical pixels. +/// The thickness of a slider's track. #[derive(Default, Clone, Copy, Debug, PartialEq)] -pub struct TrackThickness(pub f64); +pub struct TrackThickness(pub Length); impl Property for TrackThickness { fn static_default() -> &'static Self { - static DEFAULT: TrackThickness = TrackThickness(4.); + static DEFAULT: TrackThickness = TrackThickness(Length::const_px(4.)); &DEFAULT } } @@ -27,13 +28,13 @@ impl TrackThickness { } } -/// The radius of a slider's thumb, in logical pixels. +/// The radius of a slider's thumb. #[derive(Default, Clone, Copy, Debug, PartialEq)] -pub struct ThumbRadius(pub f64); +pub struct ThumbRadius(pub Length); impl Property for ThumbRadius { fn static_default() -> &'static Self { - static DEFAULT: ThumbRadius = ThumbRadius(6.); + static DEFAULT: ThumbRadius = ThumbRadius(Length::const_px(6.)); &DEFAULT } } diff --git a/masonry/src/tests/layout.rs b/masonry/src/tests/layout.rs index 1427426de..d50452314 100644 --- a/masonry/src/tests/layout.rs +++ b/masonry/src/tests/layout.rs @@ -274,12 +274,12 @@ fn content_box() { let props = ( Dimensions::fixed(100.px(), 100.px()), Padding { - left: 1., - right: 2., - top: 3., - bottom: 4., + left: 1.px(), + right: 2.px(), + top: 3.px(), + bottom: 4.px(), }, - BorderWidth::all(1.), + BorderWidth::all(1.px()), ); let hero = NewWidget::new(Button::with_text("Hero")) diff --git a/masonry/src/tests/paint.rs b/masonry/src/tests/paint.rs index e25f242de..5852d5895 100644 --- a/masonry/src/tests/paint.rs +++ b/masonry/src/tests/paint.rs @@ -330,7 +330,7 @@ fn paint_transparency() { GridParams::new(13, 0, 3, 1), ); - let props = (Padding::all(20.), Gap::new(10.px())); + let props = (Padding::all(20.px()), Gap::new(10.px())); let grid_a = grid_a.prepare().with_props(props); let grid_b = grid_b.prepare().with_props(props); diff --git a/masonry/src/tests/properties.rs b/masonry/src/tests/properties.rs index a82b6a081..8f2b44b9a 100644 --- a/masonry/src/tests/properties.rs +++ b/masonry/src/tests/properties.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::core::Widget as _; -use crate::layout::AsUnit as _; +use crate::layout::AsUnit; use crate::palette::css::BLUE; use crate::properties::{ContentColor, Dimensions, Gap}; use crate::widgets::Button; diff --git a/masonry/src/tests/transforms.rs b/masonry/src/tests/transforms.rs index b0c8dba71..bf81b52bd 100644 --- a/masonry/src/tests/transforms.rs +++ b/masonry/src/tests/transforms.rs @@ -21,7 +21,7 @@ fn blue_box(inner: impl Widget) -> impl Widget { let mut box_props = PropertySet::new(); box_props.insert(Background::Color(palette::css::BLUE)); box_props.insert(BorderColor::new(palette::css::TEAL)); - box_props.insert(BorderWidth::all(2.0)); + box_props.insert(BorderWidth::all(2.px())); WrapperWidget::new( SizedBox::new(inner.prepare()) diff --git a/masonry/src/theme.rs b/masonry/src/theme.rs index b58e751db..ce8b6b47d 100644 --- a/masonry/src/theme.rs +++ b/masonry/src/theme.rs @@ -8,7 +8,7 @@ use crate::core::{ DefaultProperties, PropertySet, PropertyStack, Selector, StyleProperty, StyleSet, }; -use crate::layout::Length; +use crate::layout::{AsUnit, Length}; use crate::palette::css::DIM_GRAY; use crate::parley::{GenericFamily, LineHeight}; use crate::peniko::Color; @@ -23,7 +23,7 @@ use crate::widgets::*; /// it should clear with this color by default. pub const BACKGROUND_COLOR: Color = Color::from_rgb8(0x1D, 0x1D, 0x1D); -pub const BORDER_WIDTH: f64 = 1.; +pub const BORDER_WIDTH: Length = Length::const_px(1.); // Zync color variations from https://tailwindcss.com/docs/colors pub const ZYNC_900: Color = Color::from_rgb8(0x18, 0x18, 0x1b); @@ -59,9 +59,9 @@ pub fn default_property_set() -> DefaultProperties { let mut properties = DefaultProperties::new(); // Badge - properties.insert::(Padding::from_vh(3., 5.)); - properties.insert::(CornerRadius { radius: 999. }); - properties.insert::(BorderWidth { width: 0. }); + properties.insert::(Padding::from_vh(3.px(), 5.px())); + properties.insert::(CornerRadius { radius: 999.px() }); + properties.insert::(BorderWidth { width: 0.px() }); properties.insert::(Background::Color(ACCENT_COLOR)); properties.insert::(BorderColor { color: ZYNC_700 }); { @@ -74,8 +74,8 @@ pub fn default_property_set() -> DefaultProperties { } // Button - properties.insert::(Padding::from_vh(6., 16.)); - properties.insert::(CornerRadius { radius: 6. }); + properties.insert::(Padding::from_vh(6.px(), 16.px())); + properties.insert::(CornerRadius { radius: 6.px() }); properties.insert::(BorderWidth { width: BORDER_WIDTH, }); @@ -103,7 +103,7 @@ pub fn default_property_set() -> DefaultProperties { } // Checkbox - properties.insert::(CornerRadius { radius: 4. }); + properties.insert::(CornerRadius { radius: 4.px() }); properties.insert::(BorderWidth { width: BORDER_WIDTH, }); @@ -142,21 +142,21 @@ pub fn default_property_set() -> DefaultProperties { Length::const_px(16.), Length::const_px(16.), )); - properties.insert::(Padding::all(4.)); + properties.insert::(Padding::all(4.px())); // Divider properties.insert::(ContentColor::new(ZYNC_500)); // Switch - properties.insert::(CornerRadius { radius: 10. }); // Full pill shape + properties.insert::(CornerRadius { radius: 10.px() }); // Full pill shape properties.insert::(BorderWidth { width: BORDER_WIDTH, }); properties.insert::(Background::Color(ZYNC_700)); properties.insert::(BorderColor { color: ZYNC_700 }); properties.insert::(ThumbColor(Color::WHITE)); - properties.insert::(ThumbRadius(8.0)); - properties.insert::(TrackThickness(20.0)); + properties.insert::(ThumbRadius(8.px())); + properties.insert::(TrackThickness(20.px())); { let mut stack = PropertyStack::new(); stack.push( @@ -186,8 +186,8 @@ pub fn default_property_set() -> DefaultProperties { use crate::widgets::Selector as SelectorButton; // Selector - properties.insert::(Padding::from_vh(6., 16.)); - properties.insert::(CornerRadius { radius: 2. }); + properties.insert::(Padding::from_vh(6.px(), 16.px())); + properties.insert::(CornerRadius { radius: 2.px() }); properties.insert::(BorderWidth { width: BORDER_WIDTH, }); @@ -216,7 +216,7 @@ pub fn default_property_set() -> DefaultProperties { } // SelectorItem - properties.insert::(Padding::from_vh(6., 16.)); + properties.insert::(Padding::from_vh(6.px(), 16.px())); properties.insert::(Background::Color(ZYNC_900)); { let mut stack = PropertyStack::new(); @@ -238,8 +238,8 @@ pub fn default_property_set() -> DefaultProperties { properties.insert::(Gap::ZERO); // TextInput - properties.insert::(Padding::from_vh(6., 12.)); - properties.insert::(CornerRadius { radius: 4. }); + properties.insert::(Padding::from_vh(6.px(), 12.px())); + properties.insert::(CornerRadius { radius: 4.px() }); properties.insert::(BorderWidth { width: BORDER_WIDTH, }); @@ -309,7 +309,7 @@ pub fn default_property_set() -> DefaultProperties { } // ProgressBar - properties.insert::(CornerRadius { radius: 2. }); + properties.insert::(CornerRadius { radius: 2.px() }); properties.insert::(BorderWidth { width: BORDER_WIDTH, }); @@ -381,8 +381,8 @@ pub fn default_text_styles(styles: &mut StyleSet) { } fn default_step_input_style(properties: &mut DefaultProperties) { - properties.insert::, _>(Padding::from_vh(6., 0.)); - properties.insert::, _>(CornerRadius { radius: 6. }); + properties.insert::, _>(Padding::from_vh(6.px(), 0.px())); + properties.insert::, _>(CornerRadius { radius: 6.px() }); properties.insert::, _>(BorderWidth { width: BORDER_WIDTH, }); diff --git a/masonry/src/widgets/align.rs b/masonry/src/widgets/align.rs index d1e60e1ff..bf6445f85 100644 --- a/masonry/src/widgets/align.rs +++ b/masonry/src/widgets/align.rs @@ -258,7 +258,7 @@ mod tests { .with_tag(align_tag) .with_props(( Dimensions::fixed(50.px(), 50.px()), - BorderWidth::all(2.), + BorderWidth::all(2.px()), BorderColor::new(palette::css::BLACK), )); let root = Align::centered(align).prepare(); diff --git a/masonry/src/widgets/button.rs b/masonry/src/widgets/button.rs index 16eb61e62..84c6d43fa 100644 --- a/masonry/src/widgets/button.rs +++ b/masonry/src/widgets/button.rs @@ -369,9 +369,9 @@ mod tests { harness.edit_root_widget(|mut button| { button.insert_prop(BorderColor { color: red }); - button.insert_prop(BorderWidth { width: 5.0 }); - button.insert_prop(CornerRadius { radius: 20.0 }); - button.insert_prop(Padding::from_vh(3., 8.)); + button.insert_prop(BorderWidth { width: 5.px() }); + button.insert_prop(CornerRadius { radius: 20.px() }); + button.insert_prop(Padding::from_vh(3.px(), 8.px())); let mut label = Button::child_mut(&mut button); label.insert_prop(ContentColor::new(red)); @@ -403,7 +403,7 @@ mod tests { ); let root_widget = NewWidget::new(grid).with_props( PropertySet::new() - .with(Padding::all(20.0)) + .with(Padding::all(20.px())) .with(Gap::new(40.px())), ); @@ -423,19 +423,19 @@ mod tests { { let mut button = Grid::get_mut(&mut grid, 1); let mut button = button.downcast::