diff options
-rw-r--r-- | graphics/src/gradient.rs | 4 | ||||
-rw-r--r-- | lazy/src/responsive.rs | 6 | ||||
-rw-r--r-- | native/src/layout/limits.rs | 9 | ||||
-rw-r--r-- | native/src/widget/operation/focusable.rs | 4 | ||||
-rw-r--r-- | src/lib.rs | 2 |
5 files changed, 16 insertions, 9 deletions
diff --git a/graphics/src/gradient.rs b/graphics/src/gradient.rs index 83f25238..61e919d6 100644 --- a/graphics/src/gradient.rs +++ b/graphics/src/gradient.rs @@ -64,7 +64,7 @@ impl From<(Point, Point)> for Position { } } -#[derive(Debug)] +#[derive(Debug, Clone, Copy)] /// The location of a relatively-positioned gradient. pub enum Location { /// Top left. @@ -86,7 +86,7 @@ pub enum Location { } impl Location { - fn to_absolute(&self, top_left: Point, size: Size) -> Point { + fn to_absolute(self, top_left: Point, size: Size) -> Point { match self { Location::TopLeft => top_left, Location::Top => { diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs index 945c935a..52badda2 100644 --- a/lazy/src/responsive.rs +++ b/lazy/src/responsive.rs @@ -280,12 +280,14 @@ where ); let Content { - element, layout, .. + element, + layout: content_layout, + .. } = content.deref_mut(); let content_layout = Layout::with_offset( layout.bounds().position() - Point::ORIGIN, - layout, + content_layout, ); element diff --git a/native/src/layout/limits.rs b/native/src/layout/limits.rs index 33a452d0..0ddee91a 100644 --- a/native/src/layout/limits.rs +++ b/native/src/layout/limits.rs @@ -153,12 +153,17 @@ impl Limits { /// Computes the resulting [`Size`] that fits the [`Limits`] given the /// intrinsic size of some content. + #[allow(clippy::manual_clamp)] pub fn resolve(&self, intrinsic_size: Size) -> Size { Size::new( - intrinsic_size.width.clamp(self.fill.width, self.max.width), + intrinsic_size + .width + .min(self.max.width) + .max(self.fill.width), intrinsic_size .height - .clamp(self.fill.height, self.max.height), + .min(self.max.height) + .max(self.fill.height), ) } } diff --git a/native/src/widget/operation/focusable.rs b/native/src/widget/operation/focusable.rs index 0067006b..312e4894 100644 --- a/native/src/widget/operation/focusable.rs +++ b/native/src/widget/operation/focusable.rs @@ -18,10 +18,10 @@ pub trait Focusable { #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct Count { /// The index of the current focused widget, if any. - focused: Option<usize>, + pub focused: Option<usize>, /// The total amount of focusable widgets. - total: usize, + pub total: usize, } /// Produces an [`Operation`] that focuses the widget with the given [`Id`]. @@ -24,7 +24,7 @@ //! [scrollables]: https://gfycat.com/perkybaggybaboon-rust-gui //! [Debug overlay with performance metrics]: https://gfycat.com/incredibledarlingbee //! [Modular ecosystem]: https://github.com/iced-rs/iced/blob/master/ECOSYSTEM.md -//! [renderer-agnostic native runtime]: https://github.com/iced-rs/iced/0.4/master/native +//! [renderer-agnostic native runtime]: https://github.com/iced-rs/iced/tree/0.6/native //! [`wgpu`]: https://github.com/gfx-rs/wgpu-rs //! [built-in renderer]: https://github.com/iced-rs/iced/tree/0.6/wgpu //! [windowing shell]: https://github.com/iced-rs/iced/tree/0.6/winit |