From ffcd4f1becbfb02435664fb4e494c1c3de97e0be Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 18 Feb 2023 08:45:54 +0100 Subject: Fix height of `overlay::Menu` --- native/src/overlay/menu.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'native/src') diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index efee14d4..50f741ef 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -344,7 +344,8 @@ where let size = { let intrinsic = Size::new( 0.0, - text_size + self.padding.vertical() * self.options.len() as f32, + (text_size + self.padding.vertical()) + * self.options.len() as f32, ); limits.resolve(intrinsic) -- cgit From 0d1656937b459237670cdc0b1f45e09d78c47494 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 18 Feb 2023 12:04:40 +0100 Subject: Bump versions :tada: --- native/src/lib.rs | 4 ++-- native/src/subscription.rs | 2 +- native/src/user_interface.rs | 4 ++-- native/src/widget.rs | 10 +++++----- native/src/widget/pane_grid.rs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'native/src') diff --git a/native/src/lib.rs b/native/src/lib.rs index 7c406ae5..ebdc8490 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -23,8 +23,8 @@ //! - Build a new renderer, see the [renderer] module. //! - Build a custom widget, start at the [`Widget`] trait. //! -//! [`iced_core`]: https://github.com/iced-rs/iced/tree/0.7/core -//! [`iced_winit`]: https://github.com/iced-rs/iced/tree/0.7/winit +//! [`iced_core`]: https://github.com/iced-rs/iced/tree/0.8/core +//! [`iced_winit`]: https://github.com/iced-rs/iced/tree/0.8/winit //! [`druid`]: https://github.com/xi-editor/druid //! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle //! [renderer]: crate::renderer diff --git a/native/src/subscription.rs b/native/src/subscription.rs index 8c92efad..b505f3cc 100644 --- a/native/src/subscription.rs +++ b/native/src/subscription.rs @@ -184,7 +184,7 @@ where /// Check out the [`websocket`] example, which showcases this pattern to maintain a WebSocket /// connection open. /// -/// [`websocket`]: https://github.com/iced-rs/iced/tree/0.7/examples/websocket +/// [`websocket`]: https://github.com/iced-rs/iced/tree/0.8/examples/websocket pub fn unfold( id: I, initial: T, diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 2358bff1..f5202609 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -21,8 +21,8 @@ use crate::{ /// The [`integration_opengl`] & [`integration_wgpu`] examples use a /// [`UserInterface`] to integrate Iced in an existing graphical application. /// -/// [`integration_opengl`]: https://github.com/iced-rs/iced/tree/0.7/examples/integration_opengl -/// [`integration_wgpu`]: https://github.com/iced-rs/iced/tree/0.7/examples/integration_wgpu +/// [`integration_opengl`]: https://github.com/iced-rs/iced/tree/0.8/examples/integration_opengl +/// [`integration_wgpu`]: https://github.com/iced-rs/iced/tree/0.8/examples/integration_wgpu #[allow(missing_debug_implementations)] pub struct UserInterface<'a, Message, Renderer> { root: Element<'a, Message, Renderer>, diff --git a/native/src/widget.rs b/native/src/widget.rs index fb759ec8..2b3ca7be 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -110,12 +110,12 @@ use crate::{Clipboard, Layout, Length, Point, Rectangle, Shell}; /// - [`geometry`], a custom widget showcasing how to draw geometry with the /// `Mesh2D` primitive in [`iced_wgpu`]. /// -/// [examples]: https://github.com/iced-rs/iced/tree/0.7/examples -/// [`bezier_tool`]: https://github.com/iced-rs/iced/tree/0.7/examples/bezier_tool -/// [`custom_widget`]: https://github.com/iced-rs/iced/tree/0.7/examples/custom_widget -/// [`geometry`]: https://github.com/iced-rs/iced/tree/0.7/examples/geometry +/// [examples]: https://github.com/iced-rs/iced/tree/0.8/examples +/// [`bezier_tool`]: https://github.com/iced-rs/iced/tree/0.8/examples/bezier_tool +/// [`custom_widget`]: https://github.com/iced-rs/iced/tree/0.8/examples/custom_widget +/// [`geometry`]: https://github.com/iced-rs/iced/tree/0.8/examples/geometry /// [`lyon`]: https://github.com/nical/lyon -/// [`iced_wgpu`]: https://github.com/iced-rs/iced/tree/0.7/wgpu +/// [`iced_wgpu`]: https://github.com/iced-rs/iced/tree/0.8/wgpu pub trait Widget where Renderer: crate::Renderer, diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index 83564c3f..bcb17ebd 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -6,7 +6,7 @@ //! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing, //! drag and drop, and hotkey support. //! -//! [`pane_grid` example]: https://github.com/iced-rs/iced/tree/0.7/examples/pane_grid +//! [`pane_grid` example]: https://github.com/iced-rs/iced/tree/0.8/examples/pane_grid mod axis; mod configuration; mod content; -- cgit From 3d8f1ad238cea6faaa168a3be516097e5817b9c2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 18 Feb 2023 21:52:08 +0100 Subject: Fix base cursor position during `UserInterface::draw` when overlay is present --- native/src/user_interface.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'native/src') diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index f5202609..68ccda55 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -440,12 +440,13 @@ where overlay.layout(renderer, self.bounds, Vector::ZERO) }); - let new_cursor_position = - if overlay_layout.bounds().contains(cursor_position) { - Point::new(-1.0, -1.0) - } else { - cursor_position - }; + let new_cursor_position = if overlay + .is_over(Layout::new(&overlay_layout), cursor_position) + { + Point::new(-1.0, -1.0) + } else { + cursor_position + }; self.overlay = Some(overlay_layout); -- cgit From bf061a0d628e97997f9af744a66239cb03ae6d78 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 18 Feb 2023 21:55:49 +0100 Subject: Remove `Clone` bound for `Bytes::new` in `image` --- native/src/image.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'native/src') diff --git a/native/src/image.rs b/native/src/image.rs index 4c5e926b..70fbade0 100644 --- a/native/src/image.rs +++ b/native/src/image.rs @@ -28,7 +28,7 @@ impl Handle { pub fn from_pixels( width: u32, height: u32, - pixels: impl AsRef<[u8]> + Clone + Send + Sync + 'static, + pixels: impl AsRef<[u8]> + Send + Sync + 'static, ) -> Handle { Self::from_data(Data::Rgba { width, @@ -44,7 +44,7 @@ impl Handle { /// This is useful if you already have your image loaded in-memory, maybe /// because you downloaded or generated it procedurally. pub fn from_memory( - bytes: impl AsRef<[u8]> + Clone + Send + Sync + 'static, + bytes: impl AsRef<[u8]> + Send + Sync + 'static, ) -> Handle { Self::from_data(Data::Bytes(Bytes::new(bytes))) } @@ -93,7 +93,7 @@ pub struct Bytes(Arc + Send + Sync + 'static>); impl Bytes { /// Creates new [`Bytes`] around `data`. - pub fn new(data: impl AsRef<[u8]> + Clone + Send + Sync + 'static) -> Self { + pub fn new(data: impl AsRef<[u8]> + Send + Sync + 'static) -> Self { Self(Arc::new(data)) } } -- cgit From 96c0bd65df5b85682a2d674b231a5ed420f106fb Mon Sep 17 00:00:00 2001 From: Casper Storm Date: Mon, 20 Feb 2023 12:24:31 +0100 Subject: Sliders no longer bleed over rail --- native/src/widget/slider.rs | 4 ++-- native/src/widget/vertical_slider.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'native/src') diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index 87030a4d..f5251dfa 100644 --- a/native/src/widget/slider.rs +++ b/native/src/widget/slider.rs @@ -423,8 +423,8 @@ pub fn draw( let handle_offset = if range_start >= range_end { 0.0 } else { - bounds.width * (value - range_start) / (range_end - range_start) - - handle_width / 2.0 + (bounds.width - handle_width) * (value - range_start) + / (range_end - range_start) }; renderer.fill_quad( diff --git a/native/src/widget/vertical_slider.rs b/native/src/widget/vertical_slider.rs index 28e8405c..0302f3cf 100644 --- a/native/src/widget/vertical_slider.rs +++ b/native/src/widget/vertical_slider.rs @@ -418,8 +418,8 @@ pub fn draw( let handle_offset = if range_start >= range_end { 0.0 } else { - bounds.height * (value - range_end) / (range_start - range_end) - - handle_width / 2.0 + (bounds.height - handle_width) * (value - range_end) + / (range_start - range_end) }; renderer.fill_quad( -- cgit