Skip to content

Commit f1db675

Browse files
committed
Merge branch 'master' into 0.8
2 parents fbca18d + 0d16569 commit f1db675

File tree

132 files changed

+2186
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2186
-850
lines changed

CHANGELOG.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.8.0] - 2023-02-18
10+
### Added
11+
- Generic pixel units. [#1711](https://github.com/iced-rs/iced/pull/1711)
12+
- `custom` method to `widget::Operation` trait. [#1649](https://github.com/iced-rs/iced/pull/1649)
13+
- `Group` overlay. [#1655](https://github.com/iced-rs/iced/pull/1655)
14+
- Standalone `draw` helper for `image`. [#1682](https://github.com/iced-rs/iced/pull/1682)
15+
- Dynamic `pick_list::Handle`. [#1675](https://github.com/iced-rs/iced/pull/1675)
16+
- `Id` support for `Container`. [#1695](https://github.com/iced-rs/iced/pull/1695)
17+
- Custom `Checkbox` icon support. [#1707](https://github.com/iced-rs/iced/pull/1707)
18+
- `window` action to change always on top setting. [#1587](https://github.com/iced-rs/iced/pull/1587)
19+
- `window` action to fetch its unique identifier. [#1589](https://github.com/iced-rs/iced/pull/1589)
20+
21+
### Changed
22+
- Annotated `Command` and `Subscription` with `#[must_use]`. [#1676](https://github.com/iced-rs/iced/pull/1676)
23+
- Replaced `Fn` with `FnOnce` in `canvas::Cache::draw`. [#1694](https://github.com/iced-rs/iced/pull/1694)
24+
- Used `[default]` on enum in `game_of_life` example. [#1660](https://github.com/iced-rs/iced/pull/1660)
25+
- Made `QRCode` hide when data is empty in `qr_code` example. [#1665](https://github.com/iced-rs/iced/pull/1665)
26+
- Replaced `Cow` with `Bytes` in `image` to accept any kind of data that implements `AsRef<[u8]>`. [#1551](https://github.com/iced-rs/iced/pull/1551)
27+
28+
### Fixed
29+
- Blank window on application startup. [#1698](https://github.com/iced-rs/iced/pull/1698)
30+
- Off-by-one pixel error on `pick_list` width. [#1679](https://github.com/iced-rs/iced/pull/1679)
31+
- Missing `text_input` implementation in `operation::Map`. [#1678](https://github.com/iced-rs/iced/pull/1678)
32+
- Widget-driven animations for `Component`. [#1685](https://github.com/iced-rs/iced/pull/1685)
33+
- Layout translation in `overlay::Group`. [#1686](https://github.com/iced-rs/iced/pull/1686)
34+
- Missing `is_over` implementation for overlays of `iced_lazy` widgets. [#1699](https://github.com/iced-rs/iced/pull/1699)
35+
- Panic when overlay event processing removes overlay. [#1700](https://github.com/iced-rs/iced/pull/1700)
36+
- Panic when using operations with components in certain cases. [#1701](https://github.com/iced-rs/iced/pull/1701)
37+
- `TextInput` width when using padding. [#1706](https://github.com/iced-rs/iced/pull/1706)
38+
- `iced_glow` crash on some hardware. [#1703](https://github.com/iced-rs/iced/pull/1703)
39+
- Height of `overlay::Menu`. [#1714](https://github.com/iced-rs/iced/pull/1714)
40+
- Size of images in `README`. [#1659](https://github.com/iced-rs/iced/pull/1659)
41+
- New `clippy` lints. [#1681](https://github.com/iced-rs/iced/pull/1681)
42+
43+
Many thanks to...
44+
45+
- @13r0ck
46+
- @bungoboingo
47+
- @casperstorm
48+
- @frey
49+
- @greatest-ape
50+
- @ids1024
51+
- @Jedsek
52+
- @nicksenger
53+
- @Night-Hunter-NF
54+
- @sdroege
55+
- @Sn-Kinos
56+
- @sushigiri
57+
- @tarkah
58+
959
## [0.7.0] - 2023-01-14
1060
### Added
1161
- Widget-driven animations. [#1647](https://github.com/iced-rs/iced/pull/1647)
@@ -364,7 +414,8 @@ Many thanks to...
364414
### Added
365415
- First release! :tada:
366416

367-
[Unreleased]: https://github.com/iced-rs/iced/compare/0.7.0...HEAD
417+
[Unreleased]: https://github.com/iced-rs/iced/compare/0.8.0...HEAD
418+
[0.8.0]: https://github.com/iced-rs/iced/compare/0.7.0...0.8.0
368419
[0.7.0]: https://github.com/iced-rs/iced/compare/0.6.0...0.7.0
369420
[0.6.0]: https://github.com/iced-rs/iced/compare/0.5.0...0.6.0
370421
[0.5.0]: https://github.com/iced-rs/iced/compare/0.4.2...0.5.0

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "iced"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
55
edition = "2021"
66
description = "A cross-platform GUI library inspired by Elm"
@@ -66,13 +66,13 @@ members = [
6666
]
6767

6868
[dependencies]
69-
iced_core = { version = "0.7", path = "core" }
70-
iced_futures = { version = "0.5", path = "futures" }
71-
iced_native = { version = "0.8", path = "native" }
72-
iced_graphics = { version = "0.6", path = "graphics" }
73-
iced_winit = { version = "0.7", path = "winit", features = ["application"] }
74-
iced_glutin = { version = "0.6", path = "glutin", optional = true }
75-
iced_glow = { version = "0.6", path = "glow", optional = true }
69+
iced_core = { version = "0.8", path = "core" }
70+
iced_futures = { version = "0.6", path = "futures" }
71+
iced_native = { version = "0.9", path = "native" }
72+
iced_graphics = { version = "0.7", path = "graphics" }
73+
iced_winit = { version = "0.8", path = "winit", features = ["application"] }
74+
iced_glutin = { version = "0.7", path = "glutin", optional = true }
75+
iced_glow = { version = "0.7", path = "glow", optional = true }
7676
thiserror = "1.0"
7777

7878
[dependencies.image_rs]
@@ -81,10 +81,10 @@ package = "image"
8181
optional = true
8282

8383
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
84-
iced_wgpu = { version = "0.8", path = "wgpu", optional = true }
84+
iced_wgpu = { version = "0.9", path = "wgpu", optional = true }
8585

8686
[target.'cfg(target_arch = "wasm32")'.dependencies]
87-
iced_wgpu = { version = "0.8", path = "wgpu", features = ["webgl"], optional = true }
87+
iced_wgpu = { version = "0.9", path = "wgpu", features = ["webgl"], optional = true }
8888

8989
[package.metadata.docs.rs]
9090
rustdoc-args = ["--cfg", "docsrs"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ A cross-platform GUI library for Rust focused on simplicity and type-safety.
1515
Inspired by [Elm].
1616

1717
<a href="https://gfycat.com/littlesanehalicore">
18-
<img src="https://thumbs.gfycat.com/LittleSaneHalicore-small.gif" height="350px">
18+
<img src="https://thumbs.gfycat.com/LittleSaneHalicore-small.gif" width="275px">
1919
</a>
2020
<a href="https://gfycat.com/politeadorableiberianmole">
21-
<img src="https://thumbs.gfycat.com/PoliteAdorableIberianmole-small.gif" height="350px">
21+
<img src="https://thumbs.gfycat.com/PoliteAdorableIberianmole-small.gif" width="273px">
2222
</a>
2323

2424
</div>
@@ -68,7 +68,7 @@ __Iced is currently experimental software.__ [Take a look at the roadmap],
6868
Add `iced` as a dependency in your `Cargo.toml`:
6969

7070
```toml
71-
iced = "0.7"
71+
iced = "0.8"
7272
```
7373

7474
If your project is using a Rust edition older than 2021, then you will need to
@@ -215,7 +215,7 @@ cargo run --features iced/glow --package game_of_life
215215
and then use it in your project with
216216

217217
```toml
218-
iced = { version = "0.7", default-features = false, features = ["glow"] }
218+
iced = { version = "0.8", default-features = false, features = ["glow"] }
219219
```
220220

221221
__NOTE:__ Chances are you have hardware that supports at least OpenGL 2.1 or OpenGL ES 2.0,

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "iced_core"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = ["Héctor Ramón Jiménez <[email protected]>"]
55
edition = "2021"
66
description = "The essential concepts of Iced"

core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This crate is meant to be a starting point for an Iced runtime.
1818
Add `iced_core` as a dependency in your `Cargo.toml`:
1919

2020
```toml
21-
iced_core = "0.7"
21+
iced_core = "0.8"
2222
```
2323

2424
__Iced moves fast and the `master` branch can contain breaking changes!__ If

core/src/length.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// The strategy used to fill space in a specific dimension.
2-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2+
#[derive(Debug, Clone, Copy, PartialEq)]
33
pub enum Length {
44
/// Fill all the remaining space
55
Fill,
@@ -17,7 +17,7 @@ pub enum Length {
1717
Shrink,
1818

1919
/// Fill a fixed amount of space
20-
Units(u16),
20+
Fixed(f32),
2121
}
2222

2323
impl Length {
@@ -31,13 +31,19 @@ impl Length {
3131
Length::Fill => 1,
3232
Length::FillPortion(factor) => *factor,
3333
Length::Shrink => 0,
34-
Length::Units(_) => 0,
34+
Length::Fixed(_) => 0,
3535
}
3636
}
3737
}
3838

39+
impl From<f32> for Length {
40+
fn from(amount: f32) -> Self {
41+
Length::Fixed(amount)
42+
}
43+
}
44+
3945
impl From<u16> for Length {
4046
fn from(units: u16) -> Self {
41-
Length::Units(units)
47+
Length::Fixed(f32::from(units))
4248
}
4349
}

core/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! ![The foundations of the Iced ecosystem](https://github.com/iced-rs/iced/blob/0525d76ff94e828b7b21634fa94a747022001c83/docs/graphs/foundations.png?raw=true)
88
//!
99
//! [Iced]: https://github.com/iced-rs/iced
10-
//! [`iced_native`]: https://github.com/iced-rs/iced/tree/0.7/native
10+
//! [`iced_native`]: https://github.com/iced-rs/iced/tree/0.8/native
1111
//! [`iced_web`]: https://github.com/iced-rs/iced_web
1212
#![doc(
1313
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
@@ -35,6 +35,7 @@ mod content_fit;
3535
mod font;
3636
mod length;
3737
mod padding;
38+
mod pixels;
3839
mod point;
3940
mod rectangle;
4041
mod size;
@@ -47,6 +48,7 @@ pub use content_fit::ContentFit;
4748
pub use font::Font;
4849
pub use length::Length;
4950
pub use padding::Padding;
51+
pub use pixels::Pixels;
5052
pub use point::Point;
5153
pub use rectangle::Rectangle;
5254
pub use size::Size;

core/src/padding.rs

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ use crate::Size;
3333
/// let widget = Widget::new().padding([10, 20]); // top/bottom, left/right
3434
/// let widget = Widget::new().padding([5, 10, 15, 20]); // top, right, bottom, left
3535
/// ```
36-
#[derive(Debug, Hash, Copy, Clone)]
36+
#[derive(Debug, Copy, Clone)]
3737
pub struct Padding {
3838
/// Top padding
39-
pub top: u16,
39+
pub top: f32,
4040
/// Right padding
41-
pub right: u16,
41+
pub right: f32,
4242
/// Bottom padding
43-
pub bottom: u16,
43+
pub bottom: f32,
4444
/// Left padding
45-
pub left: u16,
45+
pub left: f32,
4646
}
4747

4848
impl Padding {
4949
/// Padding of zero
5050
pub const ZERO: Padding = Padding {
51-
top: 0,
52-
right: 0,
53-
bottom: 0,
54-
left: 0,
51+
top: 0.0,
52+
right: 0.0,
53+
bottom: 0.0,
54+
left: 0.0,
5555
};
5656

5757
/// Create a Padding that is equal on all sides
58-
pub const fn new(padding: u16) -> Padding {
58+
pub const fn new(padding: f32) -> Padding {
5959
Padding {
6060
top: padding,
6161
right: padding,
@@ -65,12 +65,12 @@ impl Padding {
6565
}
6666

6767
/// Returns the total amount of vertical [`Padding`].
68-
pub fn vertical(self) -> u16 {
68+
pub fn vertical(self) -> f32 {
6969
self.top + self.bottom
7070
}
7171

7272
/// Returns the total amount of horizontal [`Padding`].
73-
pub fn horizontal(self) -> u16 {
73+
pub fn horizontal(self) -> f32 {
7474
self.left + self.right
7575
}
7676

@@ -79,16 +79,49 @@ impl Padding {
7979
let available = (outer - inner).max(Size::ZERO);
8080

8181
Padding {
82-
top: self.top.min((available.height as u16) / 2),
83-
right: self.right.min((available.width as u16) / 2),
84-
bottom: self.bottom.min((available.height as u16) / 2),
85-
left: self.left.min((available.width as u16) / 2),
82+
top: self.top.min(available.height / 2.0),
83+
right: self.right.min(available.width / 2.0),
84+
bottom: self.bottom.min(available.height / 2.0),
85+
left: self.left.min(available.width / 2.0),
8686
}
8787
}
8888
}
8989

9090
impl From<u16> for Padding {
9191
fn from(p: u16) -> Self {
92+
Padding {
93+
top: f32::from(p),
94+
right: f32::from(p),
95+
bottom: f32::from(p),
96+
left: f32::from(p),
97+
}
98+
}
99+
}
100+
101+
impl From<[u16; 2]> for Padding {
102+
fn from(p: [u16; 2]) -> Self {
103+
Padding {
104+
top: f32::from(p[0]),
105+
right: f32::from(p[1]),
106+
bottom: f32::from(p[0]),
107+
left: f32::from(p[1]),
108+
}
109+
}
110+
}
111+
112+
impl From<[u16; 4]> for Padding {
113+
fn from(p: [u16; 4]) -> Self {
114+
Padding {
115+
top: f32::from(p[0]),
116+
right: f32::from(p[1]),
117+
bottom: f32::from(p[2]),
118+
left: f32::from(p[3]),
119+
}
120+
}
121+
}
122+
123+
impl From<f32> for Padding {
124+
fn from(p: f32) -> Self {
92125
Padding {
93126
top: p,
94127
right: p,
@@ -98,8 +131,8 @@ impl From<u16> for Padding {
98131
}
99132
}
100133

101-
impl From<[u16; 2]> for Padding {
102-
fn from(p: [u16; 2]) -> Self {
134+
impl From<[f32; 2]> for Padding {
135+
fn from(p: [f32; 2]) -> Self {
103136
Padding {
104137
top: p[0],
105138
right: p[1],
@@ -109,8 +142,8 @@ impl From<[u16; 2]> for Padding {
109142
}
110143
}
111144

112-
impl From<[u16; 4]> for Padding {
113-
fn from(p: [u16; 4]) -> Self {
145+
impl From<[f32; 4]> for Padding {
146+
fn from(p: [f32; 4]) -> Self {
114147
Padding {
115148
top: p[0],
116149
right: p[1],

core/src/pixels.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// An amount of logical pixels.
2+
///
3+
/// Normally used to represent an amount of space, or the size of something.
4+
///
5+
/// This type is normally asked as an argument in a generic way
6+
/// (e.g. `impl Into<Pixels>`) and, since `Pixels` implements `From` both for
7+
/// `f32` and `u16`, you should be able to provide both integers and float
8+
/// literals as needed.
9+
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
10+
pub struct Pixels(pub f32);
11+
12+
impl From<f32> for Pixels {
13+
fn from(amount: f32) -> Self {
14+
Self(amount)
15+
}
16+
}
17+
18+
impl From<u16> for Pixels {
19+
fn from(amount: u16) -> Self {
20+
Self(f32::from(amount))
21+
}
22+
}

core/src/size.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl Size {
2929
/// Increments the [`Size`] to account for the given padding.
3030
pub fn pad(&self, padding: Padding) -> Self {
3131
Size {
32-
width: self.width + padding.horizontal() as f32,
33-
height: self.height + padding.vertical() as f32,
32+
width: self.width + padding.horizontal(),
33+
height: self.height + padding.vertical(),
3434
}
3535
}
3636

0 commit comments

Comments
 (0)