diff options
| author | 2020-07-08 11:44:40 +0200 | |
|---|---|---|
| committer | 2020-07-08 11:44:40 +0200 | |
| commit | f3dfaa2c43bad16fc91660b2b73cb9173549e7ec (patch) | |
| tree | 353365f4dd1e3136bc651ac8c1572f62fff1304b /graphics | |
| parent | 072ec69d53d2708d8fd1693151bcec7305efccf8 (diff) | |
| parent | 5c4f5ae5ecb36703a95cafb2cd58692529c9466d (diff) | |
| download | iced-f3dfaa2c43bad16fc91660b2b73cb9173549e7ec.tar.gz iced-f3dfaa2c43bad16fc91660b2b73cb9173549e7ec.tar.bz2 iced-f3dfaa2c43bad16fc91660b2b73cb9173549e7ec.zip | |
Merge branch 'master' into feature/pane-grid-titlebar
Diffstat (limited to 'graphics')
| -rw-r--r-- | graphics/src/backend.rs | 3 | ||||
| -rw-r--r-- | graphics/src/lib.rs | 6 | ||||
| -rw-r--r-- | graphics/src/widget/button.rs | 2 | ||||
| -rw-r--r-- | graphics/src/widget/canvas/path/builder.rs | 2 | ||||
| -rw-r--r-- | graphics/src/widget/slider.rs | 4 | ||||
| -rw-r--r-- | graphics/src/widget/text.rs | 4 | ||||
| -rw-r--r-- | graphics/src/widget/text_input.rs | 6 | ||||
| -rw-r--r-- | graphics/src/window/compositor.rs | 3 | ||||
| -rw-r--r-- | graphics/src/window/gl_compositor.rs | 3 | 
9 files changed, 17 insertions, 16 deletions
| 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/lib.rs b/graphics/src/lib.rs index b6dda132..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; @@ -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/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() 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)); 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<Backend>>; +pub type Slider<'a, T, Message, Backend> = +    iced_native::Slider<'a, T, Message, Renderer<Backend>>;  const HANDLE_HEIGHT: f32 = 22.0; 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, 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<B> text_input::Renderer for Renderer<B>  where      B: Backend + backend::Text,  { -    type Font = Font;      type Style = Box<dyn StyleSheet>; -    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(); 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: &<Self::Renderer as iced_native::Renderer>::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: &<Self::Renderer as iced_native::Renderer>::Output,          overlay: &[T],      ) -> mouse::Interaction; | 
