mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 04:18:11 +08:00
Add layer locking feature (#1702)
* Add locking layer feature * Update locked state data to adjust the refactor * Make the locked layer cannot be selected using pointer and select all key * Make locked layer cannot be moved and disable bounding box * Add locked status selected node on CopyBuffer * Make locked layer cannot be selected when selected all layers, and disabled GRS and nudging operation on locked layer * Add refresh document metadata before update button on visible and locked * Updated from master * Fix icon logic on panel locked layer * Make the child locked when the parent is locked, and the child cannot be unlocked if the parent is locked * Revert "Make the child locked when the parent is locked, and the child cannot be unlocked if the parent is locked" This reverts commit7c93259bc2. * Revert "Fix icon logic on panel locked layer" This reverts commit33939f2e84. * Delete Make Lock button in the node graph top bar * Add ToggleSelectedLocked to action_with_node_graph_open * Fix parent and child locking behavior icon on panel * Fix boolean operator on icon button locking layer * Make bolean logic more readable in icon button locking layer * Fix locking layer can be moved or resizing when selected with unlocking layer, disabled pivot widget on locking layer, disable all action on pivot point, alignment, flipping, and boolean operation for locking layer * Fix axis align drag crash --------- Co-authored-by: 0hypercube <0hypercube@gmail.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
0hypercube
parent
0f43a254af
commit
bf81a31ff9
@@ -386,12 +386,12 @@ impl Fsm for SelectToolFsmState {
|
||||
(_, SelectToolMessage::Overlays(mut overlay_context)) => {
|
||||
tool_data.snap_manager.draw_overlays(SnapData::new(document, input), &mut overlay_context);
|
||||
|
||||
let selected_layers_count = document.selected_nodes.selected_layers(document.metadata()).count();
|
||||
let selected_layers_count = document.selected_nodes.selected_unlocked_layers(document.metadata()).count();
|
||||
tool_data.selected_layers_changed = selected_layers_count != tool_data.selected_layers_count;
|
||||
tool_data.selected_layers_count = selected_layers_count;
|
||||
|
||||
// Outline selected layers
|
||||
for layer in document.selected_nodes.selected_visible_layers(document.metadata()) {
|
||||
for layer in document.selected_nodes.selected_visible_and_unlocked_layers(document.metadata()) {
|
||||
overlay_context.outline(document.metadata().layer_outline(layer), document.metadata().transform_to_viewport(layer));
|
||||
}
|
||||
|
||||
@@ -405,13 +405,13 @@ impl Fsm for SelectToolFsmState {
|
||||
// Update bounds
|
||||
let transform = document
|
||||
.selected_nodes
|
||||
.selected_visible_layers(document.metadata())
|
||||
.selected_visible_and_unlocked_layers(document.metadata())
|
||||
.next()
|
||||
.map(|layer| document.metadata().transform_to_viewport(layer));
|
||||
let transform = transform.unwrap_or(DAffine2::IDENTITY);
|
||||
let bounds = document
|
||||
.selected_nodes
|
||||
.selected_visible_layers(document.metadata())
|
||||
.selected_visible_and_unlocked_layers(document.metadata())
|
||||
.filter_map(|layer| {
|
||||
document
|
||||
.metadata()
|
||||
@@ -472,7 +472,7 @@ impl Fsm for SelectToolFsmState {
|
||||
.map(|bounding_box| bounding_box.check_rotate(input.mouse.position))
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut selected: Vec<_> = document.selected_nodes.selected_visible_layers(document.metadata()).collect();
|
||||
let mut selected: Vec<_> = document.selected_nodes.selected_visible_and_unlocked_layers(document.metadata()).collect();
|
||||
let intersection = document.click(input.mouse.position, &document.network);
|
||||
|
||||
// If the user is dragging the bounding box bounds, go into ResizingBounds mode.
|
||||
@@ -626,7 +626,7 @@ impl Fsm for SelectToolFsmState {
|
||||
let snapped = if axis_align {
|
||||
let constraint = SnapConstraint::Line {
|
||||
origin: point.document_point,
|
||||
direction: total_mouse_delta_document.normalize(),
|
||||
direction: total_mouse_delta_document.try_normalize().unwrap_or(DVec2::X),
|
||||
};
|
||||
tool_data.snap_manager.constrained_snap(&snap_data, point, constraint, None)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user