Properties: Properties doesn't offer Offset Path and Simplify for type alone (#2238)

The Quick Actions listed Object › Path's Offset Path and Simplify for every
selection, but both take paths: with type selected, the dialog opened and
could only fail ("Offset Path: select paths"). They are now left out when
every selected object is type, as Lock and Isolate Group are when they can't
run; live type offsets through the Appearance panel's Effect › Path ›
Offset Path, which works on type.
This commit is contained in:
Ridzzz0Alam
2026-10-29 23:39:21 +07:00
committed by bflatastic
parent 82e4fc422c
commit c403ad762f
2 changed files with 26 additions and 2 deletions
+10 -2
View File
@@ -142,8 +142,16 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
actions.push((tl!("Crop Image"), "ui.cropImage"));
actions.push((tl!("Mask"), "object.maskImage"));
}
actions.push((tl!("Offset Path"), "object.path.offsetPath"));
actions.push((tl!("Simplify"), "object.path.simplify"));
// Object › Path's Offset Path and Simplify take paths: type alone could only fail, and offsets
// live through the Appearance panel's Effect › Path › Offset Path (#2238).
let type_only = app.session.active().is_some_and(|st| {
let mut nodes = st.selection.objects.iter().filter_map(|id| st.doc.node(*id));
nodes.all(|n| matches!(n.kind, NodeKind::Text(_)))
});
if !type_only {
actions.push((tl!("Offset Path"), "object.path.offsetPath"));
actions.push((tl!("Simplify"), "object.path.simplify"));
}
actions.push((tl!("Arrange: Bring to Front"), "object.arrange.bringToFront"));
actions.push((tl!("Lock"), "object.lock"));
// Lock and Isolate Group are left out while their commands are off (in isolation mode, while
@@ -1647,3 +1647,19 @@ fn selected_guides_show_their_position_in_a_transform_section() {
let texts: Vec<String> = frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect();
assert!(!texts.iter().any(|t| t == "Guides") && texts.iter().any(|t| t == "W:"), "{texts:?}");
}
/// #2238: Object › Path's Offset Path and Simplify take paths, so they aren't Quick Actions for
/// type alone, where they could only fail ("select paths"); live type offsets through the
/// Appearance panel's Effect › Path › Offset Path. A path, also with type, still has them.
#[test]
fn offset_path_and_simplify_are_not_quick_actions_for_type_alone() {
let mut app = new_app();
let t = app.run("text.create", json!({"x": 50, "y": 200, "text": "Hi"})).unwrap()["id"].clone();
let ctx = egui::Context::default();
let texts = tall(&mut app, &ctx, vec![]);
assert!(!shows(&texts, "Offset Path") && !shows(&texts, "Simplify") && shows(&texts, "Lock"), "type: {texts:?}");
let r = rect(&mut app, 20.0, 20.0, 40.0, 40.0);
app.run("select.set", json!({"ids": [t, r]})).unwrap();
let texts = tall(&mut app, &ctx, vec![]);
assert!(shows(&texts, "Offset Path") && shows(&texts, "Simplify"), "type and a path: {texts:?}");
}