Merge remote-tracking branch 'origin/master' into feat/multi-window-support

This commit is contained in:
Bingus 2023-02-20 10:04:36 -08:00
commit 9565b477ca
No known key found for this signature in database
GPG key ID: 5F84D2AA40A9F170
38 changed files with 162 additions and 109 deletions

View file

@ -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<dyn AsRef<[u8]> + 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))
}
}

View file

@ -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

View file

@ -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)

View file

@ -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<I, T, Fut, Message>(
id: I,
initial: T,

View file

@ -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>,
@ -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);

View file

@ -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<Message, Renderer>
where
Renderer: crate::Renderer,

View file

@ -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;

View file

@ -421,8 +421,8 @@ pub fn draw<T, R>(
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(

View file

@ -416,8 +416,8 @@ pub fn draw<T, R>(
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(