Contextual Task Bar: the Shape Properties popup stays open for its Corner dropdown

Opening a polygon's Corner dropdown closed the Shape Properties popup,
so no corner type could be picked from it. The popup now uses
widgets::popover, which keeps it open while its dropdowns are open.
This commit is contained in:
dotCooCoo
2026-11-01 01:21:53 +07:00
committed by bflatastic
parent 5a00238a0c
commit f1a6a9ff67
2 changed files with 24 additions and 2 deletions
+3 -2
View File
@@ -267,9 +267,10 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
if let Some(shape) = &shape
&& let NodeKind::Path { live: Some(live), .. } = &shape.kind
{
// The shape's properties in a popup that stays open while its fields are edited.
// The shape's properties in a popover that stays open while its fields and
// its Corner dropdown are used.
let props = widgets::icon_button(ui, "shapes", tl!("Shape Properties"), false, 30.0);
egui::Popup::menu(&props).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {
widgets::popover(&props, props.clicked(), |ui| {
ui.set_min_width(250.0);
crate::panels::transform::live_shape_rows(app, ui, shape, live, "task-bar-shape", true);
});
+21
View File
@@ -323,6 +323,27 @@ fn the_shape_properties_popup_edits_the_shape() {
assert_eq!(sides(&app), 6);
}
/// The popup stays open while a polygon's Corner dropdown is open, so a corner type can be picked
/// from it.
#[test]
fn the_shape_properties_popup_keeps_its_corner_dropdown() {
let mut app = app();
app.run("tool.select", json!({"tool": "selection"})).unwrap();
let polygon = id(app.run("shape.polygon", json!({"cx": 100, "cy": 100, "radius": 40, "sides": 6})).unwrap());
select(&mut app, &[polygon]);
let (ctx, texts) = click_lock_slot(&mut app);
let click = |app: &mut VectorcraftApp, p: Pos2| {
let press = |pressed| Event::PointerButton { pos: p, button: PointerButton::Primary, pressed, modifiers: Default::default() };
frame(app, &ctx, vec![Event::PointerMoved(p), press(true), press(false)]);
frame(app, &ctx, vec![])
};
let texts = click(&mut app, at(&texts, "Round"));
assert!(has(&texts, "Polygon Properties:") && has(&texts, "Chamfer"), "the popup and its dropdown: {texts:?}");
click(&mut app, at(&texts, "Chamfer"));
let vectorcraft_doc::LiveShape::Polygon { kinds, .. } = live(&app, polygon) else { panic!("not a polygon") };
assert!(!kinds.is_empty() && kinds.iter().all(|k| *k == vectorcraft_geom::shapes::CornerKind::Chamfer), "{kinds:?}");
}
/// Every other selection keeps Lock: a plain closed path, a star (a plain path), a path with live
/// corners, a group and several objects. The Direct Selection tool keeps it for a basic shape.
#[test]