From 7b6f1baa69d86b6b2146bb6d61bf0cd470441db1 Mon Sep 17 00:00:00 2001 From: Vanille-N Date: Thu, 11 Jun 2020 14:58:47 +0200 Subject: Calculated sweep_angle in call to lyon::geom::Arc was actually end_angle Adresses `Arc end_angle should be renamed to span_angle #400` --- graphics/src/widget/canvas/path/builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/canvas/path/builder.rs b/graphics/src/widget/canvas/path/builder.rs index 6511fa52..e0e52845 100644 --- a/graphics/src/widget/canvas/path/builder.rs +++ b/graphics/src/widget/canvas/path/builder.rs @@ -84,7 +84,7 @@ impl Builder { radii: math::Vector::new(arc.radii.x, arc.radii.y), x_rotation: math::Angle::radians(arc.rotation), start_angle: math::Angle::radians(arc.start_angle), - sweep_angle: math::Angle::radians(arc.end_angle), + sweep_angle: math::Angle::radians(arc.end_angle - arc.start_angle), }; let _ = self.raw.move_to(arc.sample(0.0)); -- cgit From 4c0286e8acdf0792a9680f6f8212a534a51e3da0 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 12 Jun 2020 22:12:15 +0200 Subject: Add `background_color` to `Application` and `Sandbox` --- graphics/src/lib.rs | 4 ++-- graphics/src/window/compositor.rs | 3 ++- graphics/src/window/gl_compositor.rs | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'graphics/src') diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs index b6dda132..77b96655 100644 --- a/graphics/src/lib.rs +++ b/graphics/src/lib.rs @@ -35,6 +35,6 @@ pub use transformation::Transformation; pub use viewport::Viewport; pub use iced_native::{ - Background, Font, HorizontalAlignment, Point, Rectangle, Size, Vector, - VerticalAlignment, + Background, Color, Font, HorizontalAlignment, Point, Rectangle, Size, + Vector, VerticalAlignment, }; diff --git a/graphics/src/window/compositor.rs b/graphics/src/window/compositor.rs index d5920c95..aa625f43 100644 --- a/graphics/src/window/compositor.rs +++ b/graphics/src/window/compositor.rs @@ -1,4 +1,4 @@ -use crate::Viewport; +use crate::{Color, Viewport}; use iced_native::mouse; use raw_window_handle::HasRawWindowHandle; @@ -49,6 +49,7 @@ pub trait Compositor: Sized { renderer: &mut Self::Renderer, swap_chain: &mut Self::SwapChain, viewport: &Viewport, + background_color: Color, output: &::Output, overlay: &[T], ) -> mouse::Interaction; diff --git a/graphics/src/window/gl_compositor.rs b/graphics/src/window/gl_compositor.rs index 542213b5..2ba39d6e 100644 --- a/graphics/src/window/gl_compositor.rs +++ b/graphics/src/window/gl_compositor.rs @@ -1,4 +1,4 @@ -use crate::{Size, Viewport}; +use crate::{Color, Size, Viewport}; use iced_native::mouse; use core::ffi::c_void; @@ -61,6 +61,7 @@ pub trait GLCompositor: Sized { &mut self, renderer: &mut Self::Renderer, viewport: &Viewport, + background_color: Color, output: &::Output, overlay: &[T], ) -> mouse::Interaction; -- cgit From 0b819de3e22837dc456d028f51bf492891d6c3a5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 13 Jun 2020 14:17:41 +0200 Subject: Make `Slider` value type generic --- graphics/src/widget/slider.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/slider.rs b/graphics/src/widget/slider.rs index b00cde9a..da8b5a86 100644 --- a/graphics/src/widget/slider.rs +++ b/graphics/src/widget/slider.rs @@ -16,8 +16,8 @@ pub use iced_style::slider::{Handle, HandleShape, Style, StyleSheet}; /// values. /// /// This is an alias of an `iced_native` slider with an `iced_wgpu::Renderer`. -pub type Slider<'a, Message, Backend> = - iced_native::Slider<'a, Message, Renderer>; +pub type Slider<'a, T, Message, Backend> = + iced_native::Slider<'a, T, Message, Renderer>; const HANDLE_HEIGHT: f32 = 22.0; -- cgit From b3c192a2e478e9f2a101aecb417e316ed6900a80 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 19 Jun 2020 00:08:28 +0200 Subject: Make default text size configurable in `Settings` --- graphics/src/backend.rs | 3 +++ graphics/src/widget/text.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'graphics/src') diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs index 83510311..b73c636e 100644 --- a/graphics/src/backend.rs +++ b/graphics/src/backend.rs @@ -25,6 +25,9 @@ pub trait Text { /// [`ICON_FONT`]: #associatedconst.ICON_FONt const CHECKMARK_ICON: char; + /// Returns the default size of text. + fn default_size(&self) -> u16; + /// Measures the text contents with the given size and font, /// returning the size of a laid out paragraph that fits in the provided /// bounds. diff --git a/graphics/src/widget/text.rs b/graphics/src/widget/text.rs index 327f8e29..7e22e680 100644 --- a/graphics/src/widget/text.rs +++ b/graphics/src/widget/text.rs @@ -20,7 +20,9 @@ where { type Font = Font; - const DEFAULT_SIZE: u16 = 20; + fn default_size(&self) -> u16 { + self.backend().default_size() + } fn measure( &self, -- cgit From b5d842f877145c78f5d595a87cc1927bb6f5b86a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 27 Jun 2020 03:40:04 +0200 Subject: Show idle cursor when hovering a disabled `Button` --- graphics/src/widget/button.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/button.rs b/graphics/src/widget/button.rs index aeb862d5..ecabc868 100644 --- a/graphics/src/widget/button.rs +++ b/graphics/src/widget/button.rs @@ -103,7 +103,7 @@ where } else { content }, - if is_mouse_over { + if is_mouse_over && !is_disabled { mouse::Interaction::Pointer } else { mouse::Interaction::default() -- cgit From 1bc69e7a8a8ea59efc14fd765889895662c9ba46 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 28 Jun 2020 21:38:03 +0200 Subject: Expose `defaults` module in `iced_graphics` Fixes #429 --- graphics/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics/src') diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs index 77b96655..38d8dffa 100644 --- a/graphics/src/lib.rs +++ b/graphics/src/lib.rs @@ -9,7 +9,6 @@ #![forbid(rust_2018_idioms)] #![cfg_attr(docsrs, feature(doc_cfg))] mod antialiasing; -mod defaults; mod primitive; mod renderer; mod transformation; @@ -17,6 +16,7 @@ mod viewport; mod widget; pub mod backend; +pub mod defaults; pub mod font; pub mod layer; pub mod triangle; -- cgit From dfeb3db003d724a1c980329dab9cbfae55b7f589 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 6 Jul 2020 23:58:15 +0200 Subject: Use `default_font_size` for `TextInput` widget --- graphics/src/widget/text_input.rs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/text_input.rs b/graphics/src/widget/text_input.rs index f13f6606..575d67f5 100644 --- a/graphics/src/widget/text_input.rs +++ b/graphics/src/widget/text_input.rs @@ -27,14 +27,8 @@ impl text_input::Renderer for Renderer where B: Backend + backend::Text, { - type Font = Font; type Style = Box; - fn default_size(&self) -> u16 { - // TODO: Make this configurable - 20 - } - fn measure_value(&self, value: &str, size: u16, font: Font) -> f32 { let backend = self.backend(); -- cgit