Merge main into fix/pdf-read-counter-address-reuse

This commit is contained in:
dotCooCoo committed 2026-12-01 01:01:39 -08:00
commit 3a5a7252e2
3 files changed
+36 -5

No files matched your search

+4 -3
View File
@@ -9,7 +9,7 @@ use craft::ui::choice::ChoiceLook;
use craft::ui::contract::{Bind, CaptionInk, GlyphColon, LinkLabelInk, LinkLabelUnderline, MoveBandCursor, QuietHeader, SectionRhythm};
use craft::ui::docking::IconGroupSeparator;
use craft::ui::list::{CommandHighlight, ThumbRows};
use craft::ui::menu::MenuTitleLook;
use craft::ui::menu::{MenuTitleLook, MenuTitlePad};
use craft::ui::patterns::form_dialogs::PresetCardLook;
use craft::ui::runtime::env::{RootEnv, Scale, ScrubDrags, WindowKey};
use craft::ui::runtime::frame::{FrameInput, FrameOutput};
@@ -818,8 +818,9 @@ pub(crate) fn root_env(prefs: &vectorcraft_engine::Prefs, native_ppp: f32, print
root.values.set(ThumbRows::Tight);
// The Layers Objects search field fills the filter bar up to its Filter button, as production's did.
root.values.set(ObjectsSearch::Fill);
// The menu bar's titles are production's egui buttons: a push button high, 2 points beside the text, rounded.
root.values.set(MenuTitleLook::Button);
// The menu bar's titles are menu rows with the control padding (`space.pad.control`) on each side of the text.
root.values.set(MenuTitleLook::Row);
root.values.set(MenuTitlePad::Control);
// The title bar and the panel headers keep the arrow, over the menu titles too, as production's did.
root.values.set(MoveBandCursor::Arrow);
// Document tabs show their title and its `*` in the label's semibold face, as production drew them.
+4 -2
View File
@@ -5,6 +5,7 @@ use std::cell::RefCell;
use craft::behavior::IconId;
use craft::menu::MenuBarUi;
use craft::theme::ControlSize;
use craft::ui::buttons::{Button, IconButton, ToggleButton};
use craft::ui::contract::{Bind, BodyCx, Gap, Props, Show, ShowContainer};
use craft::ui::display::Picture;
@@ -101,8 +102,9 @@ fn leading(ui: &mut Ui, app: &mut VectorcraftApp) {
}
let mut home = menus::home_showing(app);
let before = home;
// The title bar's Home has no rule after it, as an options bar's `BarHome` does.
ToggleButton::new(tl!("Home"), Bind::bound(&mut home)).icon(IconSpec::svg(IconId::new("home"))).icon_only().show(ui);
// The title bar's Home has no rule after it, as an options bar's `BarHome` does. It is a small control: its square
// and glyph take the small sizes (`size.control.sm`, `size.icon.glyph_sm`).
ToggleButton::new(tl!("Home"), Bind::bound(&mut home)).icon(IconSpec::svg(IconId::new("home"))).icon_only().size(ControlSize::Sm).show(ui);
if home != before {
app.run("app.home", json!({})).ok();
}
+28
View File
@@ -548,6 +548,34 @@ fn the_app_bar_keeps_its_right_hand_controls_an_item_gap_apart() {
}
}
/// The app bar's Home is a small control (`size.control.sm` high), and each menu title keeps `space.pad.control`
/// between its text and the edges of its highlight.
#[test]
fn the_app_bar_home_is_small_and_menu_titles_pad_their_text() {
crate::i18n::set_current(crate::i18n::Lang::EN);
let app = crate::VectorcraftApp::new(Session::new(), Default::default());
let read = Rc::new(std::cell::Cell::new((0.0_f32, 0.0_f32)));
let set = Rc::clone(&read);
let mut bar = Shown::new(app, egui::vec2(1600.0, 600.0), move |app, ui| {
let tokens = &craft::ui::runtime::env::Env::of(ui).tokens;
set.set((tokens.size.control.sm, tokens.space.pad.control));
app.ui(ui);
});
bar.frame(Vec::new()).frame(Vec::new());
let (small, pad) = read.get();
assert!(small > 0.0 && pad > 0.0, "the sizes are read from the theme");
let home = bar.starting("Home").unwrap_or_else(|| panic!("Home shows in {:?}", bar.names())).rect;
assert!(home.height() <= small + 0.5, "Home is {} high, over the small control height {small}", home.height());
let texts = bar.texts();
for title in ["File", "Edit", "Object"] {
let rect = bar.find(title).unwrap_or_else(|| panic!("{title} shows in {:?}", bar.names())).rect;
let text =
texts.iter().find(|t| t.text == title && rect.contains(t.bounds.center())).unwrap_or_else(|| panic!("{title}'s text in {texts:?}"));
let (left, right) = (text.bounds.left() - rect.left(), rect.right() - text.bounds.right());
assert!(left >= pad - 0.5 && right >= pad - 0.5, "{title}'s text is {left} and {right} from its edges, under {pad}");
}
}
/// A text the status bar painted, with where it lies.
#[derive(Debug)]
struct StatusText {