| 34 |
34 |
|
//! every call site decides. [`makeover_layout::Depth::pressed`] is what keeps
|
| 35 |
35 |
|
//! the decision from being re-derived per widget.
|
| 36 |
36 |
|
//!
|
|
37 |
+ |
//! # 0.11.0: the overlay becomes reachable
|
|
38 |
+ |
//!
|
|
39 |
+ |
//! 0.10.0 answered what overlaying means in immediate mode with
|
|
40 |
+ |
//! [`Palette::cast`], and nothing could ask: the description had no
|
|
41 |
+ |
//! `Depth::Overlay` until `makeover-layout` 0.14.0, so the answer sat beside a
|
|
42 |
+ |
//! question that could not be posed. [`frame`] now hands the cast shadow to the
|
|
43 |
+ |
//! `egui::Frame` for any depth whose fill is [`Fill::Overlay`], keyed off the
|
|
44 |
+ |
//! fill rather than the variant.
|
|
45 |
+ |
//!
|
|
46 |
+ |
//! The same release brings `makeover_layout::CellPart`, which this renderer
|
|
47 |
+ |
//! carries and does not draw. No table is drawn here yet, and the vocabulary is
|
|
48 |
+ |
//! what makes drawing one possible without inventing a private name for what a
|
|
49 |
+ |
//! cell holds -- which is the whole reason it lives in the description rather
|
|
50 |
+ |
//! than in `quasi`.
|
|
51 |
+ |
//!
|
| 37 |
52 |
|
//! # Forms
|
| 38 |
53 |
|
//!
|
| 39 |
54 |
|
//! 0.5.0 adds the field vocabulary on top of the depth vocabulary:
|
| 295 |
310 |
|
if let Some(fill) = depth.fill().and_then(|f| palette.fill(f)) {
|
| 296 |
311 |
|
f = f.fill(fill);
|
| 297 |
312 |
|
}
|
|
313 |
+ |
// A surface that overlays the page is cast onto it. [`Palette::cast`] has
|
|
314 |
+ |
// answered what that means here since 0.10.0 and nothing could reach it: a
|
|
315 |
+ |
// description had no way to say Overlay until makeover-layout 0.14.0, so
|
|
316 |
+ |
// the answer sat beside the question. Keyed off the fill rather than the
|
|
317 |
+ |
// variant, so it stays right for whatever else the description calls an
|
|
318 |
+ |
// overlay later.
|
|
319 |
+ |
if depth.fill() == Some(Fill::Overlay) {
|
|
320 |
+ |
f = f.shadow(palette.cast());
|
|
321 |
+ |
}
|
| 298 |
322 |
|
let framed = f.show(ui, add_contents);
|
| 299 |
323 |
|
if let Some(bevel) = depth.bevel() {
|
| 300 |
324 |
|
paint_bevel(
|
| 705 |
729 |
|
assert_ne!(raised, well);
|
| 706 |
730 |
|
}
|
| 707 |
731 |
|
|
|
732 |
+ |
#[test]
|
|
733 |
+ |
fn an_overlay_is_cast_onto_the_page_and_takes_no_edge() {
|
|
734 |
+ |
// makeover-layout 0.14.0 is what made this reachable. The answer was
|
|
735 |
+ |
// already here at 0.10.0 and the question could not be asked.
|
|
736 |
+ |
let p = palette(Color32::from_rgb(9, 9, 9));
|
|
737 |
+ |
assert_eq!(
|
|
738 |
+ |
Depth::Overlay.fill().and_then(|f| p.fill(f)),
|
|
739 |
+ |
Some(p.overlay)
|
|
740 |
+ |
);
|
|
741 |
+ |
assert_eq!(Depth::Overlay.bevel(), None);
|
|
742 |
+ |
// The shadow `frame` reaches for is the theme's tone rather than
|
|
743 |
+ |
// egui's default, which is the whole reason `cast` exists.
|
|
744 |
+ |
assert_eq!(p.cast().color, p.elevation);
|
|
745 |
+ |
}
|
|
746 |
+ |
|
| 708 |
747 |
|
#[test]
|
| 709 |
748 |
|
fn the_lit_edge_swaps_when_a_card_is_pressed() {
|
| 710 |
749 |
|
let p = palette(Color32::from_rgb(9, 9, 9));
|