Merge branch 'master' into feature/pane-grid-titlebar

This commit is contained in:
Héctor Ramón Jiménez 2020-07-08 11:44:40 +02:00
commit f3dfaa2c43
59 changed files with 1064 additions and 311 deletions

View file

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

View file

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

View file

@ -103,7 +103,7 @@ where
} else {
content
},
if is_mouse_over {
if is_mouse_over && !is_disabled {
mouse::Interaction::Pointer
} else {
mouse::Interaction::default()

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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