mirror of
https://github.com/danbulant/cushy
synced 2026-06-19 06:21:15 +00:00
Simplifying drop shadow
Also making example regeneration automatic in CI for the guide
This commit is contained in:
parent
a3903463ea
commit
997cc9586f
4 changed files with 10 additions and 8 deletions
4
.github/workflows/docs.yml
vendored
4
.github/workflows/docs.yml
vendored
|
|
@ -48,6 +48,10 @@ jobs:
|
|||
run: |
|
||||
cargo install mdbook-variables
|
||||
|
||||
- name: Regenerate Example Images
|
||||
run: |
|
||||
CAPTURE=1 cargo test -p guide-examples --examples
|
||||
|
||||
- name: Build Guide
|
||||
run: |
|
||||
./mdbook build guide
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ impl BookExample {
|
|||
name,
|
||||
recorder: interface
|
||||
.contain()
|
||||
.shadow(ContainerShadow::drop(Px::new(16), Px::new(32)))
|
||||
.shadow(ContainerShadow::drop(Px::new(16)))
|
||||
.width(Px::new(750))
|
||||
.build_recorder()
|
||||
.with_alpha()
|
||||
|
|
|
|||
|
|
@ -704,16 +704,14 @@ impl<Unit> ContainerShadow<Unit> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns a drop shadow placed `distance` below with a combined
|
||||
/// blur/spread radius of `blur`.
|
||||
pub fn drop(distance: Unit, blur: Unit) -> Self
|
||||
/// Returns a drop shadow placed `distance` below.
|
||||
pub fn drop(distance: Unit) -> Self
|
||||
where
|
||||
Unit: Zero + Div<i32, Output = Unit> + Default + Copy,
|
||||
{
|
||||
let half_blur = blur / 2;
|
||||
Self::new(Point::new(Unit::ZERO, distance))
|
||||
.blur_radius(half_blur)
|
||||
.spread(half_blur)
|
||||
.blur_radius(distance)
|
||||
.spread(distance / 2)
|
||||
}
|
||||
|
||||
/// Sets the shadow color and returns self.
|
||||
|
|
|
|||
|
|
@ -870,7 +870,7 @@ impl WrapperWidget for Tooltipped {
|
|||
.clone()
|
||||
.contain()
|
||||
.background_color(background_color)
|
||||
.shadow(ContainerShadow::drop(Lp::mm(1), Lp::mm(2))),
|
||||
.shadow(ContainerShadow::drop(Lp::mm(1))),
|
||||
)
|
||||
.hide_on_unhover()
|
||||
.near(my_id, data.direction)
|
||||
|
|
|
|||
Loading…
Reference in a new issue