From a339f51d22d25013348bf9dc2672597653a4a94d Mon Sep 17 00:00:00 2001 From: Nick Senger Date: Sun, 28 May 2023 21:07:54 -0700 Subject: [PATCH] feat: wgpu quad shadows --- core/src/element.rs | 1 + core/src/lib.rs | 2 + core/src/renderer.rs | 5 +- core/src/shadow.rs | 15 ++++++ examples/custom_quad/src/main.rs | 7 ++- examples/custom_widget/src/main.rs | 1 + examples/modal/src/main.rs | 1 + graphics/src/primitive.rs | 6 +++ graphics/src/renderer.rs | 3 ++ src/lib.rs | 2 +- tiny_skia/src/backend.rs | 1 + wgpu/src/layer.rs | 16 +++++- wgpu/src/layer/quad.rs | 83 ++++++++++++++++++++++-------- wgpu/src/quad.rs | 6 +++ wgpu/src/shader/quad.wgsl | 71 +++++++++++++++++++------ widget/src/button.rs | 2 + widget/src/checkbox.rs | 1 + widget/src/container.rs | 1 + widget/src/overlay/menu.rs | 2 + widget/src/pane_grid.rs | 2 + widget/src/pick_list.rs | 1 + widget/src/progress_bar.rs | 2 + widget/src/radio.rs | 2 + widget/src/rule.rs | 1 + widget/src/scrollable.rs | 2 + widget/src/slider.rs | 3 ++ widget/src/text_input.rs | 3 ++ widget/src/toggler.rs | 2 + widget/src/vertical_slider.rs | 3 ++ 29 files changed, 204 insertions(+), 43 deletions(-) create mode 100644 core/src/shadow.rs diff --git a/core/src/element.rs b/core/src/element.rs index 98c5373786..e651308c99 100644 --- a/core/src/element.rs +++ b/core/src/element.rs @@ -558,6 +558,7 @@ where border_color: color, border_width: 1.0, border_radius: 0.0.into(), + shadow: Default::default(), }, Color::TRANSPARENT, ); diff --git a/core/src/lib.rs b/core/src/lib.rs index 76d775e7dd..0c1dadaebb 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -35,6 +35,7 @@ pub mod layout; pub mod mouse; pub mod overlay; pub mod renderer; +pub mod shadow; pub mod svg; pub mod text; pub mod time; @@ -78,6 +79,7 @@ pub use pixels::Pixels; pub use point::Point; pub use rectangle::Rectangle; pub use renderer::Renderer; +pub use shadow::Shadow; pub use shell::Shell; pub use size::Size; pub use text::Text; diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 7c73d2e431..1109f3c6aa 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -6,7 +6,7 @@ mod null; pub use null::Null; use crate::layout; -use crate::{Background, BorderRadius, Color, Element, Rectangle, Vector}; +use crate::{Background, BorderRadius, Color, Element, Rectangle, Vector, Shadow}; /// A component that can be used by widgets to draw themselves on a screen. pub trait Renderer: Sized { @@ -58,6 +58,9 @@ pub struct Quad { /// The border color of the [`Quad`]. pub border_color: Color, + + /// The shadow of the [`Quad`]. + pub shadow: Shadow } /// The styling attributes of a [`Renderer`]. diff --git a/core/src/shadow.rs b/core/src/shadow.rs new file mode 100644 index 0000000000..2cc476502a --- /dev/null +++ b/core/src/shadow.rs @@ -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 softness of the shadow + pub softness: f32 +} diff --git a/examples/custom_quad/src/main.rs b/examples/custom_quad/src/main.rs index b07f42ce87..f093964407 100644 --- a/examples/custom_quad/src/main.rs +++ b/examples/custom_quad/src/main.rs @@ -3,7 +3,7 @@ mod quad { use iced::advanced::layout::{self, Layout}; use iced::advanced::renderer; use iced::advanced::widget::{self, Widget}; - use iced::{Color, Element, Length, Point, Rectangle, Size}; + use iced::{Color, Element, Length, Point, Rectangle, Shadow, Size, Vector}; pub struct CustomQuad { size: f32, @@ -57,6 +57,11 @@ mod quad { border_radius: self.radius.into(), border_width: self.border_width, border_color: Color::from_rgb(1.0, 0.0, 0.0), + shadow: Shadow { + color: Color::BLACK, + offset: Vector::new(0.0, 8.0), + softness: 16.0, + }, }, Color::BLACK, ); diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs index 7854548c02..70bfa4e76c 100644 --- a/examples/custom_widget/src/main.rs +++ b/examples/custom_widget/src/main.rs @@ -64,6 +64,7 @@ mod circle { border_radius: self.radius.into(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, Color::BLACK, ); diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs index 9e1e4c2fca..f78aa5602c 100644 --- a/examples/modal/src/main.rs +++ b/examples/modal/src/main.rs @@ -421,6 +421,7 @@ mod modal { border_radius: Default::default(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, Color { a: 0.80, diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index 9728db39f8..fba7132e33 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -45,6 +45,12 @@ pub enum Primitive { border_width: f32, /// The border color of the quad border_color: Color, + /// The shadow color of the quad + shadow_color: Color, + /// The shadow offset of the quad + shadow_offset: Vector, + /// The shadow softness of the quad + shadow_softness: f32, }, /// An image primitive Image { diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs index de90550399..1b18b59634 100644 --- a/graphics/src/renderer.rs +++ b/graphics/src/renderer.rs @@ -106,6 +106,9 @@ where border_radius: quad.border_radius.into(), border_width: quad.border_width, border_color: quad.border_color, + shadow_color: quad.shadow.color, + shadow_offset: quad.shadow.offset, + shadow_softness: quad.shadow.softness, }); } diff --git a/src/lib.rs b/src/lib.rs index a0b8a95610..bca7babef3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,7 +191,7 @@ pub use crate::core::event; pub use crate::core::gradient; pub use crate::core::{ color, Alignment, Background, Color, ContentFit, Degrees, Gradient, Length, - Padding, Pixels, Point, Radians, Rectangle, Size, Vector, + Padding, Pixels, Point, Radians, Rectangle, Shadow, Size, Vector, }; pub use crate::runtime::Command; diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs index 9d0fc527da..daccbb6d28 100644 --- a/tiny_skia/src/backend.rs +++ b/tiny_skia/src/backend.rs @@ -158,6 +158,7 @@ impl Backend { border_radius, border_width, border_color, + .. } => { let physical_bounds = (*bounds + translation) * scale_factor; diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs index 980d807bb8..6c3bfcf31f 100644 --- a/wgpu/src/layer.rs +++ b/wgpu/src/layer.rs @@ -7,7 +7,7 @@ pub mod quad; pub use image::Image; pub use mesh::Mesh; -pub use quad::Quad; +pub use quad::solid::Quad; pub use text::Text; use crate::core; @@ -159,6 +159,9 @@ impl<'a> Layer<'a> { border_radius, border_width, border_color, + shadow_color, + shadow_offset, + shadow_softness, } => { let layer = &mut layers[current_layer]; @@ -171,6 +174,9 @@ impl<'a> Layer<'a> { border_color: border_color.into_linear(), border_radius: *border_radius, border_width: *border_width, + shadow_color: shadow_color.into_linear(), + shadow_offset: (*shadow_offset).into(), + shadow_softness: *shadow_softness, }; match background { @@ -189,7 +195,13 @@ impl<'a> Layer<'a> { quad.size.into(), ), ), - quad, + quad: quad::gradient::Quad { + position: quad.position, + size: quad.size, + border_color: quad.border_color, + border_radius: quad.border_radius, + border_width: quad.border_width + }, }; layer.quads.gradients.push(quad); diff --git a/wgpu/src/layer/quad.rs b/wgpu/src/layer/quad.rs index 9913cfe00d..a7e74481aa 100644 --- a/wgpu/src/layer/quad.rs +++ b/wgpu/src/layer/quad.rs @@ -2,26 +2,6 @@ use bytemuck::{Pod, Zeroable}; -/// The properties of a quad. -#[derive(Clone, Copy, Debug, Pod, Zeroable)] -#[repr(C)] -pub struct Quad { - /// The position of the [`Quad`]. - pub position: [f32; 2], - - /// The size of the [`Quad`]. - pub size: [f32; 2], - - /// The border color of the [`Quad`], in __linear RGB__. - pub border_color: [f32; 4], - - /// The border radii of the [`Quad`]. - pub border_radius: [f32; 4], - - /// The border width of the [`Quad`]. - pub border_width: f32, -} - /// A quad filled with a solid color. #[derive(Clone, Copy, Debug, Pod, Zeroable)] #[repr(C)] @@ -30,7 +10,41 @@ pub struct Solid { pub color: [f32; 4], /// The [`Quad`] data of the [`Solid`]. - pub quad: Quad, + pub quad: solid::Quad, +} + +/// Solid quad +pub mod solid { + use bytemuck::{Pod, Zeroable}; + + /// The properties of a quad. + #[derive(Clone, Copy, Debug, Pod, Zeroable)] + #[repr(C)] + pub struct Quad { + /// The position of the [`Quad`]. + pub position: [f32; 2], + + /// The size of the [`Quad`]. + pub size: [f32; 2], + + /// The border color of the [`Quad`], in __linear RGB__. + pub border_color: [f32; 4], + + /// The border radii of the [`Quad`]. + pub border_radius: [f32; 4], + + /// The border width of the [`Quad`]. + 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 softness of the [`Quad`]. + pub shadow_softness: f32, + } } /// A quad filled with interpolated colors. @@ -41,7 +55,7 @@ pub struct Gradient { pub gradient: [f32; 44], /// The [`Quad`] data of the [`Gradient`]. - pub quad: Quad, + pub quad: gradient::Quad, } #[allow(unsafe_code)] @@ -49,3 +63,28 @@ unsafe impl Pod for Gradient {} #[allow(unsafe_code)] unsafe impl Zeroable for Gradient {} + +/// Gradient quad +pub mod gradient { + use bytemuck::{Pod, Zeroable}; + + /// The properties of a quad. + #[derive(Clone, Copy, Debug, Pod, Zeroable)] + #[repr(C)] + pub struct Quad { + /// The position of the [`Quad`]. + pub position: [f32; 2], + + /// The size of the [`Quad`]. + pub size: [f32; 2], + + /// The border color of the [`Quad`], in __linear RGB__. + pub border_color: [f32; 4], + + /// The border radii of the [`Quad`]. + pub border_radius: [f32; 4], + + /// The border width of the [`Quad`]. + pub border_width: f32, + } +} diff --git a/wgpu/src/quad.rs b/wgpu/src/quad.rs index 0125ec0bf8..5c974d9853 100644 --- a/wgpu/src/quad.rs +++ b/wgpu/src/quad.rs @@ -294,6 +294,12 @@ mod solid { 5 => Float32x4, // Border width 6 => Float32, + // Shadow color + 7 => Float32x4, + // Shadow offset + 8 => Float32x2, + // Shadow softness + 9 => Float32, ), }, ], diff --git a/wgpu/src/shader/quad.wgsl b/wgpu/src/shader/quad.wgsl index 3232bdbeea..a09384880a 100644 --- a/wgpu/src/shader/quad.wgsl +++ b/wgpu/src/shader/quad.wgsl @@ -46,6 +46,9 @@ struct SolidVertexInput { @location(4) border_color: vec4, @location(5) border_radius: vec4, @location(6) border_width: f32, + @location(7) shadow_color: vec4, + @location(8) shadow_offset: vec2, + @location(9) shadow_softness: f32, } struct SolidVertexOutput { @@ -56,14 +59,19 @@ struct SolidVertexOutput { @location(3) scale: vec2, @location(4) border_radius: vec4, @location(5) border_width: f32, + @location(6) shadow_color: vec4, + @location(7) shadow_offset: vec2, + @location(8) shadow_softness: f32, } @vertex fn solid_vs_main(input: SolidVertexInput) -> SolidVertexOutput { var out: SolidVertexOutput; - var pos: vec2 = input.pos * globals.scale; - var scale: vec2 = input.scale * globals.scale; + var pos: vec2 = (input.pos + min(input.shadow_offset, vec2(0.0, 0.0)) - input.shadow_softness) * globals.scale; + var quad_pos: vec2 = input.pos * globals.scale; + var scale: vec2 = (input.scale + (vec2(max(0.0, input.shadow_offset.x), max(0.0, input.shadow_offset.y)) + input.shadow_softness) * 2.0) * globals.scale; + var quad_scale: vec2 = input.scale * globals.scale; var min_border_radius = min(input.scale.x, input.scale.y) * 0.5; var border_radius: vec4 = vec4( @@ -83,10 +91,13 @@ fn solid_vs_main(input: SolidVertexInput) -> SolidVertexOutput { out.position = globals.transform * transform * vec4(input.v_pos, 0.0, 1.0); out.color = input.color; out.border_color = input.border_color; - out.pos = pos; - out.scale = scale; + out.pos = quad_pos; + out.scale = quad_scale; out.border_radius = border_radius * 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_softness = input.shadow_softness * globals.scale; return out; } @@ -103,7 +114,7 @@ fn solid_fs_main( (input.pos + input.scale * 0.5).xy ); - if (input.border_width > 0.0) { + if input.border_width > 0.0 { var internal_border: f32 = max(border_radius - input.border_width, 0.0); var internal_distance: f32 = distance_alg( @@ -135,7 +146,30 @@ fn solid_fs_main( dist ); - return vec4(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha); + let quad_color = vec4(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha); + + if input.shadow_color.a > 0.0 { + let midpoint = input.pos + (input.scale / 2.0); + var radius = input.border_radius.a; + + if input.position.x < midpoint.x && input.position.y < midpoint.y { + radius = input.border_radius.x; + } else if input.position.x < midpoint.x && input.position.y > midpoint.y { + radius = input.border_radius.a; + } else if input.position.x > midpoint.x && input.position.y < midpoint.y { + radius = input.border_radius.y; + } else if input.position.x > midpoint.x && input.position.y > midpoint.y { + radius = input.border_radius.z; + } + + let shadow_distance = rounded_box_sdf(input.position.xy - input.pos - input.shadow_offset - (input.scale / 2.0), input.scale / 2.0, radius); + let shadow_alpha = 1.0 - smoothstep(-input.shadow_softness, input.shadow_softness, shadow_distance); + let shadow_color = input.shadow_color; + + return mix(quad_color, shadow_color, (1.0 - radius_alpha) * shadow_alpha); + } else { + return quad_color; + } } struct GradientVertexInput { @@ -219,7 +253,7 @@ fn gradient_vs_main(input: GradientVertexInput) -> GradientVertexOutput { } fn random(coords: vec2) -> f32 { - return fract(sin(dot(coords, vec2(12.9898,78.233))) * 43758.5453); + return fract(sin(dot(coords, vec2(12.9898, 78.233))) * 43758.5453); } /// Returns the current interpolated color with a max 8-stop gradient @@ -245,25 +279,25 @@ fn gradient( var color: vec4; - let noise_granularity: f32 = 0.3/255.0; + let noise_granularity: f32 = 0.3 / 255.0; for (var i: i32 = 0; i < last_index; i++) { let curr_offset = offsets_arr[i]; - let next_offset = offsets_arr[i+1]; + let next_offset = offsets_arr[i + 1]; - if (coord_offset <= offsets_arr[0]) { + if coord_offset <= offsets_arr[0] { color = colors_arr[0]; } - if (curr_offset <= coord_offset && coord_offset <= next_offset) { - color = mix(colors_arr[i], colors_arr[i+1], smoothstep( + if curr_offset <= coord_offset && coord_offset <= next_offset { + color = mix(colors_arr[i], colors_arr[i + 1], smoothstep( curr_offset, next_offset, coord_offset, )); } - if (coord_offset >= offsets_arr[last_index]) { + if coord_offset >= offsets_arr[last_index] { color = colors_arr[last_index]; } } @@ -298,7 +332,7 @@ fn gradient_fs_main(input: GradientVertexOutput) -> @location(0) vec4 { //TODO could just pass this in to the shader but is probably more performant to just check it here var last_index = 7; for (var i: i32 = 0; i <= 7; i++) { - if (offsets[i] > 1.0) { + if offsets[i] > 1.0 { last_index = i - 1; break; } @@ -315,7 +349,7 @@ fn gradient_fs_main(input: GradientVertexOutput) -> @location(0) vec4 { (pos + scale * 0.5).xy ); - if (input.border_width > 0.0) { + if input.border_width > 0.0 { var internal_border: f32 = max(border_radius - input.border_width, 0.0); var internal_distance: f32 = distance_alg( @@ -344,7 +378,12 @@ fn gradient_fs_main(input: GradientVertexOutput) -> @location(0) vec4 { var radius_alpha: f32 = 1.0 - smoothstep( max(border_radius - 0.5, 0.0), border_radius + 0.5, - dist); + dist + ); return vec4(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha); } + +fn rounded_box_sdf(center_position: vec2, size: vec2, radius: f32) -> f32 { + return length(max(abs(center_position) - size + vec2(radius, radius), vec2(0.0, 0.0))) - radius; +} diff --git a/widget/src/button.rs b/widget/src/button.rs index 70fed1d531..2436ba72dc 100644 --- a/widget/src/button.rs +++ b/widget/src/button.rs @@ -398,6 +398,7 @@ where border_radius: styling.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, Background::Color([0.0, 0.0, 0.0, 0.5].into()), ); @@ -409,6 +410,7 @@ where border_radius: styling.border_radius, border_width: styling.border_width, border_color: styling.border_color, + shadow: Default::default(), }, styling .background diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs index 4c8a989be8..5d3f9e6134 100644 --- a/widget/src/checkbox.rs +++ b/widget/src/checkbox.rs @@ -272,6 +272,7 @@ where border_radius: custom_style.border_radius, border_width: custom_style.border_width, border_color: custom_style.border_color, + shadow: Default::default(), }, custom_style.background, ); diff --git a/widget/src/container.rs b/widget/src/container.rs index 13e765515f..eb05c758df 100644 --- a/widget/src/container.rs +++ b/widget/src/container.rs @@ -335,6 +335,7 @@ pub fn draw_background( border_radius: appearance.border_radius, border_width: appearance.border_width, border_color: appearance.border_color, + shadow: Default::default(), }, appearance .background diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs index 84cc800cb1..c0af098ccf 100644 --- a/widget/src/overlay/menu.rs +++ b/widget/src/overlay/menu.rs @@ -308,6 +308,7 @@ where border_color: appearance.border_color, border_width: appearance.border_width, border_radius: appearance.border_radius, + shadow: Default::default(), }, appearance.background, ); @@ -516,6 +517,7 @@ where border_color: Color::TRANSPARENT, border_width: 0.0, border_radius: appearance.border_radius, + shadow: Default::default(), }, appearance.selected_background, ); diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs index 7bddc4a641..a9b395b98f 100644 --- a/widget/src/pane_grid.rs +++ b/widget/src/pane_grid.rs @@ -860,6 +860,7 @@ pub fn draw( .border_radius, border_width: hovered_region_style.border_width, border_color: hovered_region_style.border_color, + shadow: Default::default(), }, theme.hovered_region(style).background, ); @@ -933,6 +934,7 @@ pub fn draw( border_radius: 0.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, highlight.color, ); diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index dcd0629b89..6cb53cfe2f 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -625,6 +625,7 @@ pub fn draw<'a, T, Renderer>( border_color: style.border_color, border_width: style.border_width, border_radius: style.border_radius, + shadow: Default::default(), }, style.background, ); diff --git a/widget/src/progress_bar.rs b/widget/src/progress_bar.rs index 9e1e9131aa..93c33dc9cd 100644 --- a/widget/src/progress_bar.rs +++ b/widget/src/progress_bar.rs @@ -136,6 +136,7 @@ where border_radius: style.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.background, ); @@ -150,6 +151,7 @@ where border_radius: style.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.bar, ); diff --git a/widget/src/radio.rs b/widget/src/radio.rs index 9dad1e22a2..48735abe4a 100644 --- a/widget/src/radio.rs +++ b/widget/src/radio.rs @@ -298,6 +298,7 @@ where border_radius: (size / 2.0).into(), border_width: custom_style.border_width, border_color: custom_style.border_color, + shadow: Default::default(), }, custom_style.background, ); @@ -314,6 +315,7 @@ where border_radius: (dot_size / 2.0).into(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, custom_style.dot_color, ); diff --git a/widget/src/rule.rs b/widget/src/rule.rs index 272bd2b3b3..21c2b6e65d 100644 --- a/widget/src/rule.rs +++ b/widget/src/rule.rs @@ -128,6 +128,7 @@ where border_radius: style.radius, border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.color, ); diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 12e544c512..747cf8edab 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -821,6 +821,7 @@ pub fn draw( border_radius: style.border_radius, border_width: style.border_width, border_color: style.border_color, + shadow: Default::default(), }, style .background @@ -841,6 +842,7 @@ pub fn draw( border_radius: style.scroller.border_radius, border_width: style.scroller.border_width, border_color: style.scroller.border_color, + shadow: Default::default(), }, style.scroller.color, ); diff --git a/widget/src/slider.rs b/widget/src/slider.rs index 2851d8c3a1..f914decd74 100644 --- a/widget/src/slider.rs +++ b/widget/src/slider.rs @@ -406,6 +406,7 @@ pub fn draw( border_radius: Default::default(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.rail.colors.0, ); @@ -421,6 +422,7 @@ pub fn draw( border_radius: Default::default(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.rail.colors.1, ); @@ -436,6 +438,7 @@ pub fn draw( border_radius: handle_border_radius, border_width: style.handle.border_width, border_color: style.handle.border_color, + shadow: Default::default(), }, style.handle.color, ); diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index 8f243c1a82..0f4053f985 100644 --- a/widget/src/text_input.rs +++ b/widget/src/text_input.rs @@ -985,6 +985,7 @@ pub fn draw( border_radius: appearance.border_radius, border_width: appearance.border_width, border_color: appearance.border_color, + shadow: Default::default(), }, appearance.background, ); @@ -1043,6 +1044,7 @@ pub fn draw( border_radius: 0.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, theme.value_color(style), )) @@ -1090,6 +1092,7 @@ pub fn draw( border_radius: 0.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, theme.selection_color(style), )), diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs index b1ba65c95b..09ee0d536f 100644 --- a/widget/src/toggler.rs +++ b/widget/src/toggler.rs @@ -304,6 +304,7 @@ where border_color: style .background_border .unwrap_or(style.background), + shadow: Default::default(), }, style.background, ); @@ -328,6 +329,7 @@ where border_color: style .foreground_border .unwrap_or(style.foreground), + shadow: Default::default(), }, style.foreground, ); diff --git a/widget/src/vertical_slider.rs b/widget/src/vertical_slider.rs index 3b2430c459..80b36666ff 100644 --- a/widget/src/vertical_slider.rs +++ b/widget/src/vertical_slider.rs @@ -404,6 +404,7 @@ pub fn draw( border_radius: Default::default(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.rail.colors.1, ); @@ -419,6 +420,7 @@ pub fn draw( border_radius: Default::default(), border_width: 0.0, border_color: Color::TRANSPARENT, + shadow: Default::default(), }, style.rail.colors.0, ); @@ -434,6 +436,7 @@ pub fn draw( border_radius: handle_border_radius, border_width: style.handle.border_width, border_color: style.handle.border_color, + shadow: Default::default(), }, style.handle.color, );