Skip to content

Commit ecc6207

Browse files
committed
Merge remote-tracking branch 'upstream/master' into workaround-winit-win32-issues
2 parents 595a5db + 6756594 commit ecc6207

91 files changed

Lines changed: 1717 additions & 840 deletions

Some content is hidden

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

CHANGELOG.md

Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,128 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88
### Added
9+
- Multi-window support. [#1964](https://github.com/iced-rs/iced/pull/1964)
10+
- `TextEditor` widget (or multi-line text input). [#2123](https://github.com/iced-rs/iced/pull/2123)
11+
- `Shader` widget. [#2085](https://github.com/iced-rs/iced/pull/2085)
12+
- Shadows. [#1882](https://github.com/iced-rs/iced/pull/1882)
13+
- Vectorial text for `Canvas`. [#2204](https://github.com/iced-rs/iced/pull/2204)
14+
- Layout consistency. [#2192](https://github.com/iced-rs/iced/pull/2192)
915
- Explicit text caching. [#2058](https://github.com/iced-rs/iced/pull/2058)
10-
- `Theme::Custom::with_fn` for custom extended palette generation. [#2067](https://github.com/iced-rs/iced/pull/2067)
16+
- Gradients in Oklab color space. [#2055](https://github.com/iced-rs/iced/pull/2055)
17+
- `Themer` widget. [#2209](https://github.com/iced-rs/iced/pull/2209)
18+
- `Transform` primitive. [#2120](https://github.com/iced-rs/iced/pull/2120)
19+
- Cut functionality for `TextEditor`. [#2215](https://github.com/iced-rs/iced/pull/2215)
20+
- Disabled support for `Checkbox`. [#2109](https://github.com/iced-rs/iced/pull/2109)
21+
- `skip_taskbar` window setting for Windows. [#2211](https://github.com/iced-rs/iced/pull/2211)
22+
- `fetch_maximized` and `fetch_minimized` window commands. [#2189](https://github.com/iced-rs/iced/pull/2189)
23+
- `text_shaping` method for `Tooltip`. [#2172](https://github.com/iced-rs/iced/pull/2172)
24+
- `hovered` styling for `Svg` widget. [#2163](https://github.com/iced-rs/iced/pull/2163)
25+
- Customizable style for `TextEditor`. [#2159](https://github.com/iced-rs/iced/pull/2159)
26+
- `RawText` variant for `Primitive` in `iced_graphics`. [#2158](https://github.com/iced-rs/iced/pull/2158)
27+
- `Stream` support for `Command`. [#2150](https://github.com/iced-rs/iced/pull/2150)
28+
- Access to bounds/content bounds from a `Scrollable` viewport. [#2072](https://github.com/iced-rs/iced/pull/2072)
29+
- `Frame::scale_nonuniform` method. [#2070](https://github.com/iced-rs/iced/pull/2070)
30+
- `theme::Custom::with_fn` to generate completely custom themes. [#2067](https://github.com/iced-rs/iced/pull/2067)
31+
- `style` attribute for `Font`. [#2041](https://github.com/iced-rs/iced/pull/2041)
32+
- Texture filtering options for `Image`. [#1894](https://github.com/iced-rs/iced/pull/1894)
33+
- `default` and `shift_step` methods for `slider` widgets. [#2100](https://github.com/iced-rs/iced/pull/2100)
34+
- `Custom` variant to `command::Action`. [#2146](https://github.com/iced-rs/iced/pull/2146)
35+
- Mouse movement events for `MouseArea`. [#2147](https://github.com/iced-rs/iced/pull/2147)
1136

1237
### Changed
13-
- Updated `wgpu` to `0.17`. [#2065](https://github.com/iced-rs/iced/pull/2065)
14-
- Changed `Button::style` to take an `impl Into<...>` for consistency. [#2046](https://github.com/iced-rs/iced/pull/2046)
38+
- Enable WebGPU backend in `wgpu` by default instead of WebGL. [#2068](https://github.com/iced-rs/iced/pull/2068)
39+
- Update `glyphon` to `0.4`. [#2203](https://github.com/iced-rs/iced/pull/2203)
40+
- Require `Send` on stored pipelines. [#2197](https://github.com/iced-rs/iced/pull/2197)
41+
- Update `wgpu` to `0.19`, `glyphon` to `0.5`, `softbuffer` to `0.4`, `window-clipboard` to `0.4`, and `raw-window-handle` to `0.6`. [#2191](https://github.com/iced-rs/iced/pull/2191)
42+
- Update `winit` to `0.29`. [#2169](https://github.com/iced-rs/iced/pull/2169)
43+
- Provide actual bounds to `Shader` primitives. [#2149](https://github.com/iced-rs/iced/pull/2149)
44+
- Deny warnings in `test` workflow. [#2135](https://github.com/iced-rs/iced/pull/2135)
45+
- Update `wgpu` to `0.18` and `cosmic-text` to `0.10`. [#2122](https://github.com/iced-rs/iced/pull/2122)
46+
- Compute vertex positions in the shader. [#2099](https://github.com/iced-rs/iced/pull/2099)
47+
- Migrate twox-hash -> xxhash-rust and switch to Xxh3 for better performance. [#2080](https://github.com/iced-rs/iced/pull/2080)
48+
- Add `keyboard` subscriptions and rename `subscription::events` to `event::listen`. [#2073](https://github.com/iced-rs/iced/pull/2073)
49+
- Use workspace dependencies and package inheritance. [#2069](https://github.com/iced-rs/iced/pull/2069)
50+
- Update `wgpu` to `0.17`. [#2065](https://github.com/iced-rs/iced/pull/2065)
51+
- Support automatic style type casting for `Button`. [#2046](https://github.com/iced-rs/iced/pull/2046)
52+
- Make `with_clip` and `with_save` in `Frame` able to return the data of the provided closure. [#1994](https://github.com/iced-rs/iced/pull/1994)
53+
- Use `Radians` for angle fields in `Arc` and `arc::Elliptical`. [#2027](https://github.com/iced-rs/iced/pull/2027)
54+
- Assert dimensions of quads are normal in `iced_tiny_skia`. [#2082](https://github.com/iced-rs/iced/pull/2082)
55+
- Remove `position` from `overlay::Element`. [#2226](https://github.com/iced-rs/iced/pull/2226)
1556

1657
### Fixed
17-
- Missing `width` attribute in `styling` example. [#2062](https://github.com/iced-rs/iced/pull/2062)
58+
- Clipping of `TextInput` selection. [#2199](https://github.com/iced-rs/iced/pull/2199)
59+
- `Paragraph::grapheme_position` when ligatures are present. [#2196](https://github.com/iced-rs/iced/pull/2196)
60+
- Docs to include missing feature tags. [#2184](https://github.com/iced-rs/iced/pull/2184)
61+
- `PaneGrid` click interaction on the top edge. [#2168](https://github.com/iced-rs/iced/pull/2168)
62+
- `iced_wgpu` not rendering text in SVGs. [#2161](https://github.com/iced-rs/iced/pull/2161)
63+
- Text clipping. [#2154](https://github.com/iced-rs/iced/pull/2154)
64+
- Layout invalidation when `Tooltip` changes `overlay`. [#2143](https://github.com/iced-rs/iced/pull/2143)
65+
- `Overlay` composition. [#2142](https://github.com/iced-rs/iced/pull/2142)
66+
- Incorrect GIF for the `progress_bar` example. [#2141](https://github.com/iced-rs/iced/pull/2141)
67+
- Standalone compilation of `iced_renderer` crate. [#2134](https://github.com/iced-rs/iced/pull/2134)
68+
- Maximize window button enabled when `Settings::resizable` is `false`. [#2124](https://github.com/iced-rs/iced/pull/2124)
69+
- Width of horizontal scrollbar in `Scrollable`. [#2084](https://github.com/iced-rs/iced/pull/2084)
70+
- `ComboBox` widget panic on wasm. [#2078](https://github.com/iced-rs/iced/pull/2078)
71+
- Majority of unresolved documentation links. [#2077](https://github.com/iced-rs/iced/pull/2077)
72+
- Web examples not running. [#2076](https://github.com/iced-rs/iced/pull/2076)
73+
- GIFs and video examples broken. [#2074](https://github.com/iced-rs/iced/pull/2074)
74+
- `@interpolate(flat)` not used as attribute. [#2071](https://github.com/iced-rs/iced/pull/2071)
75+
- `Checkbox` and `Toggler` hidden behind scrollbar in `styling` example. [#2062](https://github.com/iced-rs/iced/pull/2062)
76+
- Absolute `LineHeight` sometimes being `0`. [#2059](https://github.com/iced-rs/iced/pull/2059)
77+
- Paste while holding ALT. [#2006](https://github.com/iced-rs/iced/pull/2006)
78+
- `Command<T>::perform` to return a `Command<T>`. [#2000](https://github.com/iced-rs/iced/pull/2000)
79+
- `convert_text` not called on `Svg` trees. [#1908](https://github.com/iced-rs/iced/pull/1908)
80+
- Unused `backend.rs` file in renderer crate. [#2182](https://github.com/iced-rs/iced/pull/2182)
81+
- Some `clippy::pedantic` lints. [#2096](https://github.com/iced-rs/iced/pull/2096)
82+
- Some minor clippy fixes. [#2092](https://github.com/iced-rs/iced/pull/2092)
83+
- Clippy docs keyword quoting. [#2091](https://github.com/iced-rs/iced/pull/2091)
84+
- Clippy map transformations. [#2090](https://github.com/iced-rs/iced/pull/2090)
85+
- Inline format args for ease of reading. [#2089](https://github.com/iced-rs/iced/pull/2089)
86+
- Stuck scrolling in `Scrollable` with touch events. [#1940](https://github.com/iced-rs/iced/pull/1940)
87+
- Incorrect unit in `system::Information`. [#2223](https://github.com/iced-rs/iced/pull/2223)
88+
- `size_hint` not being called from `element::Map`. [#2224](https://github.com/iced-rs/iced/pull/2224)
89+
- `size_hint` not being called from `element::Explain`. [#2225](https://github.com/iced-rs/iced/pull/2225)
90+
- Slow touch scrolling for `TextEditor` widget. [#2140](https://github.com/iced-rs/iced/pull/2140)
1891

1992
Many thanks to...
2093

2194
- @akshayr-mecha
95+
- @alec-deason
96+
- @arslee07
97+
- @AustinMReppert
98+
- @avsaase
99+
- @blazra
100+
- @brianch
101+
- @bungoboingo
102+
- @Calastrophe
103+
- @casperstorm
104+
- @cfrenette
105+
- @Davidster
106+
- @Decodetalkers
107+
- @derezzedex
22108
- @dtzxporter
109+
- @GyulyVGC
110+
- @hicaru
111+
- @ids1024
112+
- @Imberflur
113+
- @jhannyj
114+
- @jhff
115+
- @jim-ec
116+
- @joshuamegnauth54
117+
- @jpttrssn
118+
- @lufte
119+
- @matze
120+
- @MichalLebeda
121+
- @MrAntix
122+
- @nicksenger
123+
- @Nisatru
124+
- @nyurik
125+
- @Remmirad
126+
- @ripytide
127+
- @Tahinli
128+
- @tarkah
129+
- @tzemanovic
130+
- @william-shere
23131

24132
## [0.10.0] - 2023-07-28
25133
### Added

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ keywords.workspace = true
1212

1313
[dependencies]
1414
bitflags.workspace = true
15+
glam.workspace = true
1516
log.workspace = true
1617
num-traits.workspace = true
1718
smol_str.workspace = true

core/src/angle.rs

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{Point, Rectangle, Vector};
22

33
use std::f32::consts::{FRAC_PI_2, PI};
4-
use std::ops::RangeInclusive;
4+
use std::ops::{Add, AddAssign, Div, Mul, RangeInclusive, Sub, SubAssign};
55

66
/// Degrees
77
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
@@ -13,7 +13,26 @@ pub struct Radians(pub f32);
1313

1414
impl Radians {
1515
/// The range of radians of a circle.
16-
pub const RANGE: RangeInclusive<Radians> = Radians(0.0)..=Radians(2.0 * PI);
16+
pub const RANGE: RangeInclusive<Self> = Self(0.0)..=Self(2.0 * PI);
17+
18+
/// The amount of radians in half a circle.
19+
pub const PI: Self = Self(PI);
20+
21+
/// Calculates the line in which the angle intercepts the `bounds`.
22+
pub fn to_distance(&self, bounds: &Rectangle) -> (Point, Point) {
23+
let angle = self.0 - FRAC_PI_2;
24+
let r = Vector::new(f32::cos(angle), f32::sin(angle));
25+
26+
let distance_to_rect = f32::max(
27+
f32::abs(r.x * bounds.width / 2.0),
28+
f32::abs(r.y * bounds.height / 2.0),
29+
);
30+
31+
let start = bounds.center() - r * distance_to_rect;
32+
let end = bounds.center() + r * distance_to_rect;
33+
34+
(start, end)
35+
}
1736
}
1837

1938
impl From<Degrees> for Radians {
@@ -54,20 +73,70 @@ impl num_traits::FromPrimitive for Radians {
5473
}
5574
}
5675

57-
impl Radians {
58-
/// Calculates the line in which the angle intercepts the `bounds`.
59-
pub fn to_distance(&self, bounds: &Rectangle) -> (Point, Point) {
60-
let angle = self.0 - FRAC_PI_2;
61-
let r = Vector::new(f32::cos(angle), f32::sin(angle));
76+
impl Sub for Radians {
77+
type Output = Self;
6278

63-
let distance_to_rect = f32::max(
64-
f32::abs(r.x * bounds.width / 2.0),
65-
f32::abs(r.y * bounds.height / 2.0),
66-
);
79+
fn sub(self, rhs: Self) -> Self::Output {
80+
Self(self.0 - rhs.0)
81+
}
82+
}
6783

68-
let start = bounds.center() - r * distance_to_rect;
69-
let end = bounds.center() + r * distance_to_rect;
84+
impl SubAssign for Radians {
85+
fn sub_assign(&mut self, rhs: Self) {
86+
self.0 = self.0 - rhs.0;
87+
}
88+
}
7089

71-
(start, end)
90+
impl Add for Radians {
91+
type Output = Self;
92+
93+
fn add(self, rhs: Self) -> Self::Output {
94+
Self(self.0 + rhs.0)
95+
}
96+
}
97+
98+
impl AddAssign for Radians {
99+
fn add_assign(&mut self, rhs: Radians) {
100+
self.0 = self.0 + rhs.0;
101+
}
102+
}
103+
104+
impl Mul for Radians {
105+
type Output = Self;
106+
107+
fn mul(self, rhs: Radians) -> Self::Output {
108+
Radians(self.0 * rhs.0)
109+
}
110+
}
111+
112+
impl Mul<f32> for Radians {
113+
type Output = Self;
114+
115+
fn mul(self, rhs: f32) -> Self::Output {
116+
Self(self.0 * rhs)
117+
}
118+
}
119+
120+
impl Mul<Radians> for f32 {
121+
type Output = Radians;
122+
123+
fn mul(self, rhs: Radians) -> Self::Output {
124+
Radians(self * rhs.0)
125+
}
126+
}
127+
128+
impl Div<f32> for Radians {
129+
type Output = Self;
130+
131+
fn div(self, rhs: f32) -> Self::Output {
132+
Radians(self.0 / rhs)
133+
}
134+
}
135+
136+
impl Div for Radians {
137+
type Output = Self;
138+
139+
fn div(self, rhs: Self) -> Self::Output {
140+
Self(self.0 / rhs.0)
72141
}
73142
}

core/src/element.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ where
308308
self.widget.size()
309309
}
310310

311+
fn size_hint(&self) -> Size<Length> {
312+
self.widget.size_hint()
313+
}
314+
311315
fn layout(
312316
&self,
313317
tree: &mut Tree,
@@ -442,11 +446,12 @@ where
442446
tree: &'b mut Tree,
443447
layout: Layout<'_>,
444448
renderer: &Renderer,
449+
translation: Vector,
445450
) -> Option<overlay::Element<'b, B, Theme, Renderer>> {
446451
let mapper = &self.mapper;
447452

448453
self.widget
449-
.overlay(tree, layout, renderer)
454+
.overlay(tree, layout, renderer, translation)
450455
.map(move |overlay| overlay.map(mapper))
451456
}
452457
}
@@ -477,6 +482,10 @@ where
477482
self.element.widget.size()
478483
}
479484

485+
fn size_hint(&self) -> Size<Length> {
486+
self.element.widget.size_hint()
487+
}
488+
480489
fn tag(&self) -> tree::Tag {
481490
self.element.widget.tag()
482491
}
@@ -588,7 +597,10 @@ where
588597
state: &'b mut Tree,
589598
layout: Layout<'_>,
590599
renderer: &Renderer,
600+
translation: Vector,
591601
) -> Option<overlay::Element<'b, Message, Theme, Renderer>> {
592-
self.element.widget.overlay(state, layout, renderer)
602+
self.element
603+
.widget
604+
.overlay(state, layout, renderer, translation)
593605
}
594606
}

core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ mod rectangle;
4949
mod shadow;
5050
mod shell;
5151
mod size;
52+
mod transformation;
5253
mod vector;
5354

5455
pub use alignment::Alignment;
@@ -75,6 +76,7 @@ pub use shadow::Shadow;
7576
pub use shell::Shell;
7677
pub use size::Size;
7778
pub use text::Text;
79+
pub use transformation::Transformation;
7880
pub use vector::Vector;
7981
pub use widget::Widget;
8082

core/src/mouse/interaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ pub enum Interaction {
1313
ResizingHorizontally,
1414
ResizingVertically,
1515
NotAllowed,
16+
ZoomIn,
1617
}

core/src/overlay.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@ where
2424
/// user interface.
2525
///
2626
/// [`Node`]: layout::Node
27-
fn layout(
28-
&mut self,
29-
renderer: &Renderer,
30-
bounds: Size,
31-
position: Point,
32-
translation: Vector,
33-
) -> layout::Node;
27+
fn layout(&mut self, renderer: &Renderer, bounds: Size) -> layout::Node;
3428

3529
/// Draws the [`Overlay`] using the associated `Renderer`.
3630
fn draw(
@@ -120,6 +114,7 @@ pub fn from_children<'a, Message, Theme, Renderer>(
120114
tree: &'a mut Tree,
121115
layout: Layout<'_>,
122116
renderer: &Renderer,
117+
translation: Vector,
123118
) -> Option<Element<'a, Message, Theme, Renderer>>
124119
where
125120
Renderer: crate::Renderer,
@@ -129,7 +124,9 @@ where
129124
.zip(&mut tree.children)
130125
.zip(layout.children())
131126
.filter_map(|((child, state), layout)| {
132-
child.as_widget_mut().overlay(state, layout, renderer)
127+
child
128+
.as_widget_mut()
129+
.overlay(state, layout, renderer, translation)
133130
})
134131
.collect::<Vec<_>>();
135132

0 commit comments

Comments
 (0)