mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 19:26:51 -04:00
* fix(ui): add Brushes button at top of Brush Settings control list (#4265) * test(ui): verify Brushes button at top of Brush Settings opens Brushes panel (#4265)
This commit is contained in:
1 parent
4122bc6918
commit
0d6a83e3ce
2 files changed
+27
No files matched your search
@@ -248,6 +248,21 @@ fn section_list(app: &mut PhotocraftApp, ui: &mut egui::Ui, b: &mut BrushSetting
|
||||
ui.vertical(|ui| {
|
||||
ui.set_width(150.0);
|
||||
ui.spacing_mut().item_spacing.y = 1.0;
|
||||
let (br_rect, br_resp) = ui.allocate_exact_size(vec2(150.0, 23.0), Sense::click());
|
||||
br_resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, tl!("Brushes")));
|
||||
if br_resp.hovered() {
|
||||
ui.painter().rect_filled(br_rect, t.radius_sm, t.hover);
|
||||
}
|
||||
let icon_rect = egui::Rect::from_center_size(egui::pos2(br_rect.left() + 12.0, br_rect.center().y), vec2(13.0, 13.0));
|
||||
icons::paint(ui, icon_rect, "brush", 12.0, if br_resp.hovered() { t.text } else { t.icon });
|
||||
let galley = ui.painter().layout_no_wrap(tl!("Brushes").to_string(), theme::semibold(12.0), if br_resp.hovered() { t.text } else { t.text_dim });
|
||||
ui.painter().galley(egui::pos2(br_rect.left() + 26.0, br_rect.center().y - galley.size().y / 2.0), galley, t.text);
|
||||
if br_resp.clicked() {
|
||||
let _ = crate::menus::invoke(app, ui.ctx(), "window.panel.brushes", json!({}));
|
||||
}
|
||||
ui.add_space(3.0);
|
||||
widgets::hairline(ui);
|
||||
ui.add_space(3.0);
|
||||
for (i, (name, has_box)) in SECTIONS.iter().enumerate() {
|
||||
let toggle_only = checkbox_only(i);
|
||||
// Group the switches with whitespace, not separators between individual rows.
|
||||
|
||||
@@ -1120,3 +1120,15 @@ fn hand_tool_offers_scale_buttons_and_requests_the_right_view() {
|
||||
assert!(h.state().ui.views[0].fill_pending);
|
||||
assert!(!h.state().ui.views[0].fit_pending);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn brushes_button_at_top_of_brush_settings_opens_brushes_panel() {
|
||||
use egui_kittest::kittest::Queryable;
|
||||
|
||||
let mut h = harness(0, 0);
|
||||
assert_eq!(h.state().ui.brush_tab, 0);
|
||||
h.get_by_label("Brushes").click();
|
||||
h.run_steps(3);
|
||||
assert!(h.state().ui.panels.brush_settings);
|
||||
assert_eq!(h.state().ui.brush_tab, 1);
|
||||
}
|
||||
Reference in new issue
Block a user