Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Properties: one filter leaves out Lock and Isolate Group while they're off (keeps show() within the cognitive complexity lint #4299 added)

bflatastic1924ddd1dd52
diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs
index 04b280631..1d939d635 100644
--- a/crates/ui-egui/src/panels/properties.rs
+++ b/crates/ui-egui/src/panels/properties.rs
@@ -130,10 +130,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
}
if is_group {
actions.push((tl!("Ungroup"), "object.ungroup"));
- // Isolate Group is left out while Enter Isolation Mode is off, as it is while an opacity mask is edited.
- if crate::menus::enabled(app, "object.isolate") {
- actions.push((tl!("Isolate Group"), "object.isolate"));
- }
+ actions.push((tl!("Isolate Group"), "object.isolate"));
}
if is_live {
actions.push((tl!("Expand Shape"), "object.expandShape"));
@@ -149,10 +146,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
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"));
- // Lock is listed only when Object › Lock › Selection is on, so not in isolation mode.
- if crate::menus::enabled(app, "object.lock") {
- actions.push((tl!("Lock"), "object.lock"));
- }
+ actions.push((tl!("Lock"), "object.lock"));
+ // Lock and Isolate Group are left out while their commands are off (in isolation mode, while
+ // an opacity mask is edited).
+ actions.retain(|(_, id)| !matches!(*id, "object.lock" | "object.isolate") || crate::menus::enabled(app, id));
let w = (ui.available_width() - 6.0) / 2.0;
for pair in actions.chunks(2) {
ui.horizontal(|ui| {