mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 05:38:11 +08:00
Add a stack-based Boolean Operation layer node (#1813)
* Multiple boolean operation node * Change boolean operation ordering * Complete layer boolean operation node * Automatically insert new boolean operation node * Remove divide operation * Fix subtract operations * Remove stack data from boolean operation properties * Fix images and custom vectors * Code cleanup * Use slice instead of iter to avoid infinite type recursion --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
f4e3e5ab2a
commit
9d749c49fb
@@ -148,21 +148,13 @@ impl SelectTool {
|
||||
}
|
||||
|
||||
fn boolean_widgets(&self, selected_count: usize) -> impl Iterator<Item = WidgetHolder> {
|
||||
let enabled = move |operation| {
|
||||
if operation == BooleanOperation::Union {
|
||||
(1..=2).contains(&selected_count)
|
||||
} else {
|
||||
selected_count == 2
|
||||
}
|
||||
};
|
||||
|
||||
let operations = BooleanOperation::list();
|
||||
let icons = BooleanOperation::icons();
|
||||
operations.into_iter().zip(icons).map(move |(operation, icon)| {
|
||||
IconButton::new(icon, 24)
|
||||
.tooltip(operation.to_string())
|
||||
.disabled(!enabled(operation))
|
||||
.on_update(move |_| GraphOperationMessage::InsertBooleanOperation { operation }.into())
|
||||
.disabled(selected_count == 0)
|
||||
.on_update(move |_| DocumentMessage::InsertBooleanOperation { operation }.into())
|
||||
.widget_holder()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user