feat: quad shadows
This commit is contained in:
parent
b3e3f6e3c9
commit
cc906c83cd
33 changed files with 305 additions and 25 deletions
|
|
@ -540,6 +540,7 @@ where
|
||||||
border_color: color,
|
border_color: color,
|
||||||
border_width: 1.0,
|
border_width: 1.0,
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
|
shadow: Default::default()
|
||||||
},
|
},
|
||||||
Color::TRANSPARENT,
|
Color::TRANSPARENT,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ pub mod layout;
|
||||||
pub mod mouse;
|
pub mod mouse;
|
||||||
pub mod overlay;
|
pub mod overlay;
|
||||||
pub mod renderer;
|
pub mod renderer;
|
||||||
|
pub mod shadow;
|
||||||
pub mod svg;
|
pub mod svg;
|
||||||
pub mod text;
|
pub mod text;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
|
|
@ -70,6 +71,7 @@ pub use pixels::Pixels;
|
||||||
pub use point::Point;
|
pub use point::Point;
|
||||||
pub use rectangle::Rectangle;
|
pub use rectangle::Rectangle;
|
||||||
pub use renderer::Renderer;
|
pub use renderer::Renderer;
|
||||||
|
pub use shadow::Shadow;
|
||||||
pub use shell::Shell;
|
pub use shell::Shell;
|
||||||
pub use size::Size;
|
pub use size::Size;
|
||||||
pub use text::Text;
|
pub use text::Text;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ mod null;
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
pub use null::Null;
|
pub use null::Null;
|
||||||
|
|
||||||
use crate::{Background, BorderRadius, Color, Rectangle, Vector};
|
use crate::{Background, BorderRadius, Color, Rectangle, Shadow, Vector};
|
||||||
|
|
||||||
/// A component that can be used by widgets to draw themselves on a screen.
|
/// A component that can be used by widgets to draw themselves on a screen.
|
||||||
pub trait Renderer: Sized {
|
pub trait Renderer: Sized {
|
||||||
|
|
@ -45,6 +45,9 @@ pub struct Quad {
|
||||||
|
|
||||||
/// The border color of the [`Quad`].
|
/// The border color of the [`Quad`].
|
||||||
pub border_color: Color,
|
pub border_color: Color,
|
||||||
|
|
||||||
|
/// The shadow of the [`Quad`].
|
||||||
|
pub shadow: Shadow,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The styling attributes of a [`Renderer`].
|
/// The styling attributes of a [`Renderer`].
|
||||||
|
|
|
||||||
15
core/src/shadow.rs
Normal file
15
core/src/shadow.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
//! Shadow
|
||||||
|
use crate::{Color, Vector};
|
||||||
|
|
||||||
|
/// A shadow
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||||
|
pub struct Shadow {
|
||||||
|
/// The color of the shadow
|
||||||
|
pub color: Color,
|
||||||
|
|
||||||
|
/// The offset of the shadow
|
||||||
|
pub offset: Vector,
|
||||||
|
|
||||||
|
/// The blur_radius of the shadow
|
||||||
|
pub blur_radius: f32,
|
||||||
|
}
|
||||||
|
|
@ -3,21 +3,28 @@ mod quad {
|
||||||
use iced::advanced::layout::{self, Layout};
|
use iced::advanced::layout::{self, Layout};
|
||||||
use iced::advanced::renderer;
|
use iced::advanced::renderer;
|
||||||
use iced::advanced::widget::{self, Widget};
|
use iced::advanced::widget::{self, Widget};
|
||||||
use iced::mouse;
|
use iced::{mouse, Shadow};
|
||||||
use iced::{Color, Element, Length, Rectangle, Size};
|
use iced::{Color, Element, Length, Rectangle, Size};
|
||||||
|
|
||||||
pub struct CustomQuad {
|
pub struct CustomQuad {
|
||||||
size: f32,
|
size: f32,
|
||||||
radius: [f32; 4],
|
radius: [f32; 4],
|
||||||
border_width: f32,
|
border_width: f32,
|
||||||
|
shadow: Shadow,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CustomQuad {
|
impl CustomQuad {
|
||||||
pub fn new(size: f32, radius: [f32; 4], border_width: f32) -> Self {
|
pub fn new(
|
||||||
|
size: f32,
|
||||||
|
radius: [f32; 4],
|
||||||
|
border_width: f32,
|
||||||
|
shadow: Shadow,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
size,
|
size,
|
||||||
radius,
|
radius,
|
||||||
border_width,
|
border_width,
|
||||||
|
shadow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +65,7 @@ mod quad {
|
||||||
border_radius: self.radius.into(),
|
border_radius: self.radius.into(),
|
||||||
border_width: self.border_width,
|
border_width: self.border_width,
|
||||||
border_color: Color::from_rgb(1.0, 0.0, 0.0),
|
border_color: Color::from_rgb(1.0, 0.0, 0.0),
|
||||||
|
shadow: self.shadow,
|
||||||
},
|
},
|
||||||
Color::BLACK,
|
Color::BLACK,
|
||||||
);
|
);
|
||||||
|
|
@ -75,7 +83,9 @@ mod quad {
|
||||||
}
|
}
|
||||||
|
|
||||||
use iced::widget::{column, container, slider, text};
|
use iced::widget::{column, container, slider, text};
|
||||||
use iced::{Alignment, Element, Length, Sandbox, Settings};
|
use iced::{
|
||||||
|
Alignment, Color, Element, Length, Sandbox, Settings, Shadow, Vector,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
Example::run(Settings::default())
|
Example::run(Settings::default())
|
||||||
|
|
@ -84,6 +94,7 @@ pub fn main() -> iced::Result {
|
||||||
struct Example {
|
struct Example {
|
||||||
radius: [f32; 4],
|
radius: [f32; 4],
|
||||||
border_width: f32,
|
border_width: f32,
|
||||||
|
shadow: Shadow,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
|
@ -94,6 +105,9 @@ enum Message {
|
||||||
RadiusBottomRightChanged(f32),
|
RadiusBottomRightChanged(f32),
|
||||||
RadiusBottomLeftChanged(f32),
|
RadiusBottomLeftChanged(f32),
|
||||||
BorderWidthChanged(f32),
|
BorderWidthChanged(f32),
|
||||||
|
ShadowXOffsetChanged(f32),
|
||||||
|
ShadowYOffsetChanged(f32),
|
||||||
|
ShadowBlurRadiusChanged(f32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sandbox for Example {
|
impl Sandbox for Example {
|
||||||
|
|
@ -103,6 +117,11 @@ impl Sandbox for Example {
|
||||||
Self {
|
Self {
|
||||||
radius: [50.0; 4],
|
radius: [50.0; 4],
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
|
shadow: Shadow {
|
||||||
|
color: Color::from_rgba(0.0, 0.0, 0.0, 0.8),
|
||||||
|
offset: Vector::new(0.0, 8.0),
|
||||||
|
blur_radius: 16.0,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,14 +147,33 @@ impl Sandbox for Example {
|
||||||
Message::BorderWidthChanged(width) => {
|
Message::BorderWidthChanged(width) => {
|
||||||
self.border_width = width;
|
self.border_width = width;
|
||||||
}
|
}
|
||||||
|
Message::ShadowXOffsetChanged(x) => {
|
||||||
|
self.shadow.offset.x = x;
|
||||||
|
}
|
||||||
|
Message::ShadowYOffsetChanged(y) => {
|
||||||
|
self.shadow.offset.y = y;
|
||||||
|
}
|
||||||
|
Message::ShadowBlurRadiusChanged(s) => {
|
||||||
|
self.shadow.blur_radius = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
let [tl, tr, br, bl] = self.radius;
|
let [tl, tr, br, bl] = self.radius;
|
||||||
|
let Shadow {
|
||||||
|
offset: Vector { x: sx, y: sy },
|
||||||
|
blur_radius: sr,
|
||||||
|
..
|
||||||
|
} = self.shadow;
|
||||||
|
|
||||||
let content = column![
|
let content = column![
|
||||||
quad::CustomQuad::new(200.0, self.radius, self.border_width),
|
quad::CustomQuad::new(
|
||||||
|
200.0,
|
||||||
|
self.radius,
|
||||||
|
self.border_width,
|
||||||
|
self.shadow
|
||||||
|
),
|
||||||
text(format!("Radius: {tl:.2}/{tr:.2}/{br:.2}/{bl:.2}")),
|
text(format!("Radius: {tl:.2}/{tr:.2}/{br:.2}/{bl:.2}")),
|
||||||
slider(1.0..=100.0, tl, Message::RadiusTopLeftChanged).step(0.01),
|
slider(1.0..=100.0, tl, Message::RadiusTopLeftChanged).step(0.01),
|
||||||
slider(1.0..=100.0, tr, Message::RadiusTopRightChanged).step(0.01),
|
slider(1.0..=100.0, tr, Message::RadiusTopRightChanged).step(0.01),
|
||||||
|
|
@ -145,6 +183,13 @@ impl Sandbox for Example {
|
||||||
.step(0.01),
|
.step(0.01),
|
||||||
slider(1.0..=10.0, self.border_width, Message::BorderWidthChanged)
|
slider(1.0..=10.0, self.border_width, Message::BorderWidthChanged)
|
||||||
.step(0.01),
|
.step(0.01),
|
||||||
|
text(format!("Shadow: {sx:.2}x{sy:.2}, {sr:.2}")),
|
||||||
|
slider(-100.0..=100.0, sx, Message::ShadowXOffsetChanged)
|
||||||
|
.step(0.01),
|
||||||
|
slider(-100.0..=100.0, sy, Message::ShadowYOffsetChanged)
|
||||||
|
.step(0.01),
|
||||||
|
slider(0.0..=100.0, sr, Message::ShadowBlurRadiusChanged)
|
||||||
|
.step(0.01),
|
||||||
]
|
]
|
||||||
.padding(20)
|
.padding(20)
|
||||||
.spacing(20)
|
.spacing(20)
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ mod circle {
|
||||||
border_radius: self.radius.into(),
|
border_radius: self.radius.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
Color::BLACK,
|
Color::BLACK,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,7 @@ where
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
Background::Color(custom_style.track_color),
|
Background::Color(custom_style.track_color),
|
||||||
);
|
);
|
||||||
|
|
@ -244,6 +245,7 @@ where
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
Background::Color(custom_style.bar_color),
|
Background::Color(custom_style.bar_color),
|
||||||
),
|
),
|
||||||
|
|
@ -261,6 +263,7 @@ where
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
Background::Color(custom_style.bar_color),
|
Background::Color(custom_style.bar_color),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,7 @@ mod modal {
|
||||||
border_radius: BorderRadius::default(),
|
border_radius: BorderRadius::default(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
Color {
|
Color {
|
||||||
a: 0.80,
|
a: 0.80,
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,28 @@ impl<T: Damage> Damage for Primitive<T> {
|
||||||
// damage bounds (?)
|
// damage bounds (?)
|
||||||
raw.clip_bounds.expand(1.5)
|
raw.clip_bounds.expand(1.5)
|
||||||
}
|
}
|
||||||
Self::Quad { bounds, .. }
|
Self::Quad {
|
||||||
| Self::Image { bounds, .. }
|
bounds,
|
||||||
| Self::Svg { bounds, .. } => bounds.expand(1.0),
|
shadow_offset,
|
||||||
|
shadow_blur_radius,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
let bounds_with_shadow = Rectangle {
|
||||||
|
x: bounds.x + shadow_offset.x.min(0.0) - shadow_blur_radius,
|
||||||
|
y: bounds.y + shadow_offset.y.min(0.0) - shadow_blur_radius,
|
||||||
|
width: bounds.width
|
||||||
|
+ shadow_offset.x.abs()
|
||||||
|
+ shadow_blur_radius * 2.0,
|
||||||
|
height: bounds.height
|
||||||
|
+ shadow_offset.y.abs()
|
||||||
|
+ shadow_blur_radius * 2.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
bounds_with_shadow.expand(1.0)
|
||||||
|
}
|
||||||
|
Self::Image { bounds, .. } | Self::Svg { bounds, .. } => {
|
||||||
|
bounds.expand(1.0)
|
||||||
|
}
|
||||||
Self::Clip { bounds, .. } => bounds.expand(1.0),
|
Self::Clip { bounds, .. } => bounds.expand(1.0),
|
||||||
Self::Group { primitives } => primitives
|
Self::Group { primitives } => primitives
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,12 @@ pub enum Primitive<T> {
|
||||||
border_width: f32,
|
border_width: f32,
|
||||||
/// The border color of the quad
|
/// The border color of the quad
|
||||||
border_color: Color,
|
border_color: Color,
|
||||||
|
/// The shadow color of the quad
|
||||||
|
shadow_color: Color,
|
||||||
|
/// The shadow offset of the quad
|
||||||
|
shadow_offset: Vector,
|
||||||
|
/// The shadow blur radius of the quad
|
||||||
|
shadow_blur_radius: f32,
|
||||||
},
|
},
|
||||||
/// An image primitive
|
/// An image primitive
|
||||||
Image {
|
Image {
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,9 @@ impl<B: Backend, T> iced_core::Renderer for Renderer<B, T> {
|
||||||
border_radius: quad.border_radius.into(),
|
border_radius: quad.border_radius.into(),
|
||||||
border_width: quad.border_width,
|
border_width: quad.border_width,
|
||||||
border_color: quad.border_color,
|
border_color: quad.border_color,
|
||||||
|
shadow_color: quad.shadow.color,
|
||||||
|
shadow_offset: quad.shadow.offset,
|
||||||
|
shadow_blur_radius: quad.shadow.blur_radius,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,8 @@ pub use crate::core::alignment;
|
||||||
pub use crate::core::gradient;
|
pub use crate::core::gradient;
|
||||||
pub use crate::core::{
|
pub use crate::core::{
|
||||||
color, Alignment, Background, BorderRadius, Color, ContentFit, Degrees,
|
color, Alignment, Background, BorderRadius, Color, ContentFit, Degrees,
|
||||||
Gradient, Length, Padding, Pixels, Point, Radians, Rectangle, Size, Vector,
|
Gradient, Length, Padding, Pixels, Point, Radians, Rectangle, Shadow, Size,
|
||||||
|
Vector,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod clipboard {
|
pub mod clipboard {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
use tiny_skia::Size;
|
||||||
|
|
||||||
use crate::core::{Background, Color, Gradient, Rectangle, Vector};
|
use crate::core::{Background, Color, Gradient, Rectangle, Vector};
|
||||||
use crate::graphics::backend;
|
use crate::graphics::backend;
|
||||||
use crate::graphics::text;
|
use crate::graphics::text;
|
||||||
|
|
@ -153,6 +155,9 @@ impl Backend {
|
||||||
border_radius,
|
border_radius,
|
||||||
border_width,
|
border_width,
|
||||||
border_color,
|
border_color,
|
||||||
|
shadow_color,
|
||||||
|
shadow_offset,
|
||||||
|
shadow_blur_radius,
|
||||||
} => {
|
} => {
|
||||||
let physical_bounds = (*bounds + translation) * scale_factor;
|
let physical_bounds = (*bounds + translation) * scale_factor;
|
||||||
|
|
||||||
|
|
@ -182,6 +187,107 @@ impl Backend {
|
||||||
}
|
}
|
||||||
let path = rounded_rectangle(*bounds, fill_border_radius);
|
let path = rounded_rectangle(*bounds, fill_border_radius);
|
||||||
|
|
||||||
|
if shadow_color.a > 0.0 {
|
||||||
|
fn smoothstep(a: f32, b: f32, x: f32) -> f32 {
|
||||||
|
let x = ((x - a) / (b - a)).clamp(0.0, 1.0);
|
||||||
|
|
||||||
|
x * x * (3.0 - 2.0 * x)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rounded_box_sdf(
|
||||||
|
to_center: Vector,
|
||||||
|
size: Size,
|
||||||
|
radii: &[f32],
|
||||||
|
) -> f32 {
|
||||||
|
let radius =
|
||||||
|
match (to_center.x > 0.0, to_center.y > 0.0) {
|
||||||
|
(true, true) => radii[2],
|
||||||
|
(true, false) => radii[1],
|
||||||
|
(false, true) => radii[3],
|
||||||
|
(false, false) => radii[0],
|
||||||
|
};
|
||||||
|
|
||||||
|
let x = (to_center.x.abs() - size.width() + radius)
|
||||||
|
.max(0.0);
|
||||||
|
let y = (to_center.y.abs() - size.height() + radius)
|
||||||
|
.max(0.0);
|
||||||
|
|
||||||
|
(x.powf(2.0) + y.powf(2.0)).sqrt() - radius
|
||||||
|
}
|
||||||
|
|
||||||
|
let shadow_bounds = (Rectangle {
|
||||||
|
x: bounds.x + shadow_offset.x - shadow_blur_radius,
|
||||||
|
y: bounds.y + shadow_offset.y - shadow_blur_radius,
|
||||||
|
width: bounds.width + shadow_blur_radius * 2.0,
|
||||||
|
height: bounds.height + shadow_blur_radius * 2.0,
|
||||||
|
} + translation)
|
||||||
|
* scale_factor;
|
||||||
|
|
||||||
|
let radii = fill_border_radius
|
||||||
|
.into_iter()
|
||||||
|
.map(|radius| radius * scale_factor)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let (x, y, width, height) = (
|
||||||
|
shadow_bounds.x as u32,
|
||||||
|
shadow_bounds.y as u32,
|
||||||
|
shadow_bounds.width as u32,
|
||||||
|
shadow_bounds.height as u32,
|
||||||
|
);
|
||||||
|
let half_width = physical_bounds.width / 2.0;
|
||||||
|
let half_height = physical_bounds.height / 2.0;
|
||||||
|
|
||||||
|
let colors = (y..y + height)
|
||||||
|
.flat_map(|y| {
|
||||||
|
(x..x + width).map(move |x| (x as f32, y as f32))
|
||||||
|
})
|
||||||
|
.filter_map(|(x, y)| {
|
||||||
|
Size::from_wh(half_width, half_height).map(|size| {
|
||||||
|
let shadow_distance = rounded_box_sdf(
|
||||||
|
Vector::new(
|
||||||
|
x - physical_bounds.position().x
|
||||||
|
- (shadow_offset.x * scale_factor)
|
||||||
|
- half_width,
|
||||||
|
y - physical_bounds.position().y
|
||||||
|
- (shadow_offset.y * scale_factor)
|
||||||
|
- half_height,
|
||||||
|
),
|
||||||
|
size,
|
||||||
|
&radii,
|
||||||
|
);
|
||||||
|
let shadow_alpha = 1.0
|
||||||
|
- smoothstep(
|
||||||
|
-shadow_blur_radius * scale_factor,
|
||||||
|
*shadow_blur_radius * scale_factor,
|
||||||
|
shadow_distance,
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut color = into_color(*shadow_color);
|
||||||
|
color.apply_opacity(shadow_alpha);
|
||||||
|
|
||||||
|
color.to_color_u8().premultiply()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
if let Some(p) = tiny_skia::IntSize::from_wh(width, height)
|
||||||
|
.and_then(|size| {
|
||||||
|
tiny_skia::Pixmap::from_vec(
|
||||||
|
bytemuck::cast_vec(colors),
|
||||||
|
size,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
{
|
||||||
|
pixels.draw_pixmap(
|
||||||
|
x as i32,
|
||||||
|
y as i32,
|
||||||
|
p.as_ref(),
|
||||||
|
&Default::default(),
|
||||||
|
Default::default(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pixels.fill_path(
|
pixels.fill_path(
|
||||||
&path,
|
&path,
|
||||||
&tiny_skia::Paint {
|
&tiny_skia::Paint {
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,9 @@ impl<'a> Layer<'a> {
|
||||||
border_radius,
|
border_radius,
|
||||||
border_width,
|
border_width,
|
||||||
border_color,
|
border_color,
|
||||||
|
shadow_color,
|
||||||
|
shadow_offset,
|
||||||
|
shadow_blur_radius,
|
||||||
} => {
|
} => {
|
||||||
let layer = &mut layers[current_layer];
|
let layer = &mut layers[current_layer];
|
||||||
|
|
||||||
|
|
@ -210,6 +213,9 @@ impl<'a> Layer<'a> {
|
||||||
border_color: color::pack(*border_color),
|
border_color: color::pack(*border_color),
|
||||||
border_radius: *border_radius,
|
border_radius: *border_radius,
|
||||||
border_width: *border_width,
|
border_width: *border_width,
|
||||||
|
shadow_color: shadow_color.into_linear(),
|
||||||
|
shadow_offset: (*shadow_offset).into(),
|
||||||
|
shadow_blur_radius: *shadow_blur_radius,
|
||||||
};
|
};
|
||||||
|
|
||||||
layer.quads.add(quad, background);
|
layer.quads.add(quad, background);
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,15 @@ pub struct Quad {
|
||||||
|
|
||||||
/// The border width of the [`Quad`].
|
/// The border width of the [`Quad`].
|
||||||
pub border_width: f32,
|
pub border_width: f32,
|
||||||
|
|
||||||
|
/// The shadow color of the [`Quad`].
|
||||||
|
pub shadow_color: [f32; 4],
|
||||||
|
|
||||||
|
/// The shadow offset of the [`Quad`].
|
||||||
|
pub shadow_offset: [f32; 2],
|
||||||
|
|
||||||
|
/// The shadow blur radius of the [`Quad`].
|
||||||
|
pub shadow_blur_radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A group of [`Quad`]s rendered together.
|
/// A group of [`Quad`]s rendered together.
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,12 @@ impl Pipeline {
|
||||||
4 => Float32x4,
|
4 => Float32x4,
|
||||||
// Border width
|
// Border width
|
||||||
5 => Float32,
|
5 => Float32,
|
||||||
|
// Shadow color
|
||||||
|
6 => Float32x4,
|
||||||
|
// Shadow offset
|
||||||
|
7 => Float32x2,
|
||||||
|
// Shadow blur radius
|
||||||
|
8 => Float32,
|
||||||
),
|
),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,19 +11,15 @@ fn distance_alg(
|
||||||
size: vec2<f32>,
|
size: vec2<f32>,
|
||||||
radius: f32
|
radius: f32
|
||||||
) -> f32 {
|
) -> f32 {
|
||||||
var inner_size: vec2<f32> = size - vec2<f32>(radius, radius) * 2.0;
|
var inner_half_size: vec2<f32> = (size - vec2<f32>(radius, radius) * 2.0) / 2.0;
|
||||||
var top_left: vec2<f32> = position + vec2<f32>(radius, radius);
|
var top_left: vec2<f32> = position + vec2<f32>(radius, radius);
|
||||||
var bottom_right: vec2<f32> = top_left + inner_size;
|
return rounded_box_sdf(frag_coord - top_left - inner_half_size, inner_half_size, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
var top_left_distance: vec2<f32> = top_left - frag_coord;
|
// Given a vector from a point to the center of a rounded rectangle of the given `size` and
|
||||||
var bottom_right_distance: vec2<f32> = frag_coord - bottom_right;
|
// border `radius`, determines the point's distance from the nearest edge of the rounded rectangle
|
||||||
|
fn rounded_box_sdf(to_center: vec2<f32>, size: vec2<f32>, radius: f32) -> f32 {
|
||||||
var dist: vec2<f32> = vec2<f32>(
|
return length(max(abs(to_center) - size + vec2<f32>(radius, radius), vec2<f32>(0.0, 0.0))) - radius;
|
||||||
max(max(top_left_distance.x, bottom_right_distance.x), 0.0),
|
|
||||||
max(max(top_left_distance.y, bottom_right_distance.y), 0.0)
|
|
||||||
);
|
|
||||||
|
|
||||||
return sqrt(dist.x * dist.x + dist.y * dist.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on the fragement position and the center of the quad, select one of the 4 radi.
|
// Based on the fragement position and the center of the quad, select one of the 4 radi.
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ struct SolidVertexInput {
|
||||||
@location(3) border_color: vec4<f32>,
|
@location(3) border_color: vec4<f32>,
|
||||||
@location(4) border_radius: vec4<f32>,
|
@location(4) border_radius: vec4<f32>,
|
||||||
@location(5) border_width: f32,
|
@location(5) border_width: f32,
|
||||||
|
@location(6) shadow_color: vec4<f32>,
|
||||||
|
@location(7) shadow_offset: vec2<f32>,
|
||||||
|
@location(8) shadow_blur_radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SolidVertexOutput {
|
struct SolidVertexOutput {
|
||||||
|
|
@ -16,14 +19,19 @@ struct SolidVertexOutput {
|
||||||
@location(3) scale: vec2<f32>,
|
@location(3) scale: vec2<f32>,
|
||||||
@location(4) border_radius: vec4<f32>,
|
@location(4) border_radius: vec4<f32>,
|
||||||
@location(5) border_width: f32,
|
@location(5) border_width: f32,
|
||||||
|
@location(6) shadow_color: vec4<f32>,
|
||||||
|
@location(7) shadow_offset: vec2<f32>,
|
||||||
|
@location(8) shadow_blur_radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@vertex
|
@vertex
|
||||||
fn solid_vs_main(input: SolidVertexInput) -> SolidVertexOutput {
|
fn solid_vs_main(input: SolidVertexInput) -> SolidVertexOutput {
|
||||||
var out: SolidVertexOutput;
|
var out: SolidVertexOutput;
|
||||||
|
|
||||||
var pos: vec2<f32> = input.pos * globals.scale;
|
var pos: vec2<f32> = (input.pos + min(input.shadow_offset, vec2<f32>(0.0, 0.0)) - input.shadow_blur_radius) * globals.scale;
|
||||||
var scale: vec2<f32> = input.scale * globals.scale;
|
var quad_pos: vec2<f32> = input.pos * globals.scale;
|
||||||
|
var scale: vec2<f32> = (input.scale + vec2<f32>(abs(input.shadow_offset.x), abs(input.shadow_offset.y)) + input.shadow_blur_radius * 2.0) * globals.scale;
|
||||||
|
var quad_scale: vec2<f32> = input.scale * globals.scale;
|
||||||
|
|
||||||
var min_border_radius = min(input.scale.x, input.scale.y) * 0.5;
|
var min_border_radius = min(input.scale.x, input.scale.y) * 0.5;
|
||||||
var border_radius: vec4<f32> = vec4<f32>(
|
var border_radius: vec4<f32> = vec4<f32>(
|
||||||
|
|
@ -43,10 +51,13 @@ fn solid_vs_main(input: SolidVertexInput) -> SolidVertexOutput {
|
||||||
out.position = globals.transform * transform * vec4<f32>(vertex_position(input.vertex_index), 0.0, 1.0);
|
out.position = globals.transform * transform * vec4<f32>(vertex_position(input.vertex_index), 0.0, 1.0);
|
||||||
out.color = input.color;
|
out.color = input.color;
|
||||||
out.border_color = input.border_color;
|
out.border_color = input.border_color;
|
||||||
out.pos = pos;
|
out.pos = quad_pos;
|
||||||
out.scale = scale;
|
out.scale = quad_scale;
|
||||||
out.border_radius = border_radius * globals.scale;
|
out.border_radius = border_radius * globals.scale;
|
||||||
out.border_width = input.border_width * globals.scale;
|
out.border_width = input.border_width * globals.scale;
|
||||||
|
out.shadow_color = input.shadow_color;
|
||||||
|
out.shadow_offset = input.shadow_offset * globals.scale;
|
||||||
|
out.shadow_blur_radius = input.shadow_blur_radius * globals.scale;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
@ -95,5 +106,20 @@ fn solid_fs_main(
|
||||||
dist
|
dist
|
||||||
);
|
);
|
||||||
|
|
||||||
return vec4<f32>(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha);
|
let quad_color = vec4<f32>(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha);
|
||||||
|
|
||||||
|
if input.shadow_color.a > 0.0 {
|
||||||
|
let shadow_distance = rounded_box_sdf(input.position.xy - input.pos - input.shadow_offset - (input.scale / 2.0), input.scale / 2.0, border_radius);
|
||||||
|
let shadow_alpha = 1.0 - smoothstep(-input.shadow_blur_radius, input.shadow_blur_radius, shadow_distance);
|
||||||
|
let shadow_color = input.shadow_color;
|
||||||
|
let base_color = select(
|
||||||
|
vec4<f32>(shadow_color.x, shadow_color.y, shadow_color.z, 0.0),
|
||||||
|
quad_color,
|
||||||
|
quad_color.a > 0.0
|
||||||
|
);
|
||||||
|
|
||||||
|
return mix(base_color, shadow_color, (1.0 - radius_alpha) * shadow_alpha);
|
||||||
|
} else {
|
||||||
|
return quad_color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -404,6 +404,7 @@ where
|
||||||
border_radius: styling.border_radius,
|
border_radius: styling.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
Background::Color([0.0, 0.0, 0.0, 0.5].into()),
|
Background::Color([0.0, 0.0, 0.0, 0.5].into()),
|
||||||
);
|
);
|
||||||
|
|
@ -415,6 +416,7 @@ where
|
||||||
border_radius: styling.border_radius,
|
border_radius: styling.border_radius,
|
||||||
border_width: styling.border_width,
|
border_width: styling.border_width,
|
||||||
border_color: styling.border_color,
|
border_color: styling.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
styling
|
styling
|
||||||
.background
|
.background
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,7 @@ where
|
||||||
border_radius: custom_style.border_radius,
|
border_radius: custom_style.border_radius,
|
||||||
border_width: custom_style.border_width,
|
border_width: custom_style.border_width,
|
||||||
border_color: custom_style.border_color,
|
border_color: custom_style.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
custom_style.background,
|
custom_style.background,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,7 @@ pub fn draw_background<Renderer>(
|
||||||
border_radius: appearance.border_radius,
|
border_radius: appearance.border_radius,
|
||||||
border_width: appearance.border_width,
|
border_width: appearance.border_width,
|
||||||
border_color: appearance.border_color,
|
border_color: appearance.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
appearance
|
appearance
|
||||||
.background
|
.background
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,7 @@ where
|
||||||
border_color: appearance.border_color,
|
border_color: appearance.border_color,
|
||||||
border_width: appearance.border_width,
|
border_width: appearance.border_width,
|
||||||
border_radius: appearance.border_radius,
|
border_radius: appearance.border_radius,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
appearance.background,
|
appearance.background,
|
||||||
);
|
);
|
||||||
|
|
@ -519,6 +520,7 @@ where
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_radius: appearance.border_radius,
|
border_radius: appearance.border_radius,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
appearance.selected_background,
|
appearance.selected_background,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -921,6 +921,7 @@ pub fn draw<Renderer, T>(
|
||||||
.border_radius,
|
.border_radius,
|
||||||
border_width: hovered_region_style.border_width,
|
border_width: hovered_region_style.border_width,
|
||||||
border_color: hovered_region_style.border_color,
|
border_color: hovered_region_style.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
theme.hovered_region(style).background,
|
theme.hovered_region(style).background,
|
||||||
);
|
);
|
||||||
|
|
@ -950,6 +951,7 @@ pub fn draw<Renderer, T>(
|
||||||
border_radius: hovered_region_style.border_radius,
|
border_radius: hovered_region_style.border_radius,
|
||||||
border_width: hovered_region_style.border_width,
|
border_width: hovered_region_style.border_width,
|
||||||
border_color: hovered_region_style.border_color,
|
border_color: hovered_region_style.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
theme.hovered_region(style).background,
|
theme.hovered_region(style).background,
|
||||||
);
|
);
|
||||||
|
|
@ -1013,6 +1015,7 @@ pub fn draw<Renderer, T>(
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
highlight.color,
|
highlight.color,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -656,6 +656,7 @@ pub fn draw<'a, T, Renderer>(
|
||||||
border_color: style.border_color,
|
border_color: style.border_color,
|
||||||
border_width: style.border_width,
|
border_width: style.border_width,
|
||||||
border_radius: style.border_radius,
|
border_radius: style.border_radius,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.background,
|
style.background,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@ where
|
||||||
border_radius: style.border_radius,
|
border_radius: style.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.background,
|
style.background,
|
||||||
);
|
);
|
||||||
|
|
@ -147,6 +148,7 @@ where
|
||||||
border_radius: style.border_radius,
|
border_radius: style.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.bar,
|
style.bar,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,7 @@ where
|
||||||
border_radius: (size / 2.0).into(),
|
border_radius: (size / 2.0).into(),
|
||||||
border_width: custom_style.border_width,
|
border_width: custom_style.border_width,
|
||||||
border_color: custom_style.border_color,
|
border_color: custom_style.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
custom_style.background,
|
custom_style.background,
|
||||||
);
|
);
|
||||||
|
|
@ -331,6 +332,7 @@ where
|
||||||
border_radius: (dot_size / 2.0).into(),
|
border_radius: (dot_size / 2.0).into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
custom_style.dot_color,
|
custom_style.dot_color,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ where
|
||||||
border_radius: style.radius,
|
border_radius: style.radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.color,
|
style.color,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -912,6 +912,7 @@ pub fn draw<Renderer>(
|
||||||
border_radius: style.border_radius,
|
border_radius: style.border_radius,
|
||||||
border_width: style.border_width,
|
border_width: style.border_width,
|
||||||
border_color: style.border_color,
|
border_color: style.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style
|
style
|
||||||
.background
|
.background
|
||||||
|
|
@ -932,6 +933,7 @@ pub fn draw<Renderer>(
|
||||||
border_radius: style.scroller.border_radius,
|
border_radius: style.scroller.border_radius,
|
||||||
border_width: style.scroller.border_width,
|
border_width: style.scroller.border_width,
|
||||||
border_color: style.scroller.border_color,
|
border_color: style.scroller.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.scroller.color,
|
style.scroller.color,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,7 @@ pub fn draw<T, R>(
|
||||||
border_radius: style.rail.border_radius,
|
border_radius: style.rail.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.rail.colors.0,
|
style.rail.colors.0,
|
||||||
);
|
);
|
||||||
|
|
@ -416,6 +417,7 @@ pub fn draw<T, R>(
|
||||||
border_radius: style.rail.border_radius,
|
border_radius: style.rail.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.rail.colors.1,
|
style.rail.colors.1,
|
||||||
);
|
);
|
||||||
|
|
@ -431,6 +433,7 @@ pub fn draw<T, R>(
|
||||||
border_radius: handle_border_radius,
|
border_radius: handle_border_radius,
|
||||||
border_width: style.handle.border_width,
|
border_width: style.handle.border_width,
|
||||||
border_color: style.handle.border_color,
|
border_color: style.handle.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.handle.color,
|
style.handle.color,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -470,6 +470,7 @@ where
|
||||||
border_radius: appearance.border_radius,
|
border_radius: appearance.border_radius,
|
||||||
border_width: appearance.border_width,
|
border_width: appearance.border_width,
|
||||||
border_color: appearance.border_color,
|
border_color: appearance.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
appearance.background,
|
appearance.background,
|
||||||
);
|
);
|
||||||
|
|
@ -511,6 +512,7 @@ where
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
theme.value_color(&self.style),
|
theme.value_color(&self.style),
|
||||||
);
|
);
|
||||||
|
|
@ -526,6 +528,7 @@ where
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
theme.selection_color(&self.style),
|
theme.selection_color(&self.style),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1085,6 +1085,7 @@ pub fn draw<Renderer>(
|
||||||
border_radius: appearance.border_radius,
|
border_radius: appearance.border_radius,
|
||||||
border_width: appearance.border_width,
|
border_width: appearance.border_width,
|
||||||
border_color: appearance.border_color,
|
border_color: appearance.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
appearance.background,
|
appearance.background,
|
||||||
);
|
);
|
||||||
|
|
@ -1134,6 +1135,7 @@ pub fn draw<Renderer>(
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
theme.value_color(style),
|
theme.value_color(style),
|
||||||
))
|
))
|
||||||
|
|
@ -1175,6 +1177,7 @@ pub fn draw<Renderer>(
|
||||||
border_radius: 0.0.into(),
|
border_radius: 0.0.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
theme.selection_color(style),
|
theme.selection_color(style),
|
||||||
)),
|
)),
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,7 @@ where
|
||||||
border_color: style
|
border_color: style
|
||||||
.background_border
|
.background_border
|
||||||
.unwrap_or(style.background),
|
.unwrap_or(style.background),
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.background,
|
style.background,
|
||||||
);
|
);
|
||||||
|
|
@ -341,6 +342,7 @@ where
|
||||||
border_color: style
|
border_color: style
|
||||||
.foreground_border
|
.foreground_border
|
||||||
.unwrap_or(style.foreground),
|
.unwrap_or(style.foreground),
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.foreground,
|
style.foreground,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,7 @@ pub fn draw<T, R>(
|
||||||
border_radius: style.rail.border_radius,
|
border_radius: style.rail.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.rail.colors.1,
|
style.rail.colors.1,
|
||||||
);
|
);
|
||||||
|
|
@ -415,6 +416,7 @@ pub fn draw<T, R>(
|
||||||
border_radius: style.rail.border_radius,
|
border_radius: style.rail.border_radius,
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.rail.colors.0,
|
style.rail.colors.0,
|
||||||
);
|
);
|
||||||
|
|
@ -430,6 +432,7 @@ pub fn draw<T, R>(
|
||||||
border_radius: handle_border_radius,
|
border_radius: handle_border_radius,
|
||||||
border_width: style.handle.border_width,
|
border_width: style.handle.border_width,
|
||||||
border_color: style.handle.border_color,
|
border_color: style.handle.border_color,
|
||||||
|
shadow: Default::default(),
|
||||||
},
|
},
|
||||||
style.handle.color,
|
style.handle.color,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue