mirror of
https://github.com/danbulant/cushy
synced 2026-07-06 11:40:37 +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: |
|
run: |
|
||||||
cargo install mdbook-variables
|
cargo install mdbook-variables
|
||||||
|
|
||||||
|
- name: Regenerate Example Images
|
||||||
|
run: |
|
||||||
|
CAPTURE=1 cargo test -p guide-examples --examples
|
||||||
|
|
||||||
- name: Build Guide
|
- name: Build Guide
|
||||||
run: |
|
run: |
|
||||||
./mdbook build guide
|
./mdbook build guide
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ impl BookExample {
|
||||||
name,
|
name,
|
||||||
recorder: interface
|
recorder: interface
|
||||||
.contain()
|
.contain()
|
||||||
.shadow(ContainerShadow::drop(Px::new(16), Px::new(32)))
|
.shadow(ContainerShadow::drop(Px::new(16)))
|
||||||
.width(Px::new(750))
|
.width(Px::new(750))
|
||||||
.build_recorder()
|
.build_recorder()
|
||||||
.with_alpha()
|
.with_alpha()
|
||||||
|
|
|
||||||
|
|
@ -704,16 +704,14 @@ impl<Unit> ContainerShadow<Unit> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a drop shadow placed `distance` below with a combined
|
/// Returns a drop shadow placed `distance` below.
|
||||||
/// blur/spread radius of `blur`.
|
pub fn drop(distance: Unit) -> Self
|
||||||
pub fn drop(distance: Unit, blur: Unit) -> Self
|
|
||||||
where
|
where
|
||||||
Unit: Zero + Div<i32, Output = Unit> + Default + Copy,
|
Unit: Zero + Div<i32, Output = Unit> + Default + Copy,
|
||||||
{
|
{
|
||||||
let half_blur = blur / 2;
|
|
||||||
Self::new(Point::new(Unit::ZERO, distance))
|
Self::new(Point::new(Unit::ZERO, distance))
|
||||||
.blur_radius(half_blur)
|
.blur_radius(distance)
|
||||||
.spread(half_blur)
|
.spread(distance / 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the shadow color and returns self.
|
/// Sets the shadow color and returns self.
|
||||||
|
|
|
||||||
|
|
@ -870,7 +870,7 @@ impl WrapperWidget for Tooltipped {
|
||||||
.clone()
|
.clone()
|
||||||
.contain()
|
.contain()
|
||||||
.background_color(background_color)
|
.background_color(background_color)
|
||||||
.shadow(ContainerShadow::drop(Lp::mm(1), Lp::mm(2))),
|
.shadow(ContainerShadow::drop(Lp::mm(1))),
|
||||||
)
|
)
|
||||||
.hide_on_unhover()
|
.hide_on_unhover()
|
||||||
.near(my_id, data.direction)
|
.near(my_id, data.direction)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue