Fix #1174: Spline does not have mirror handles enabled (#1182)

* Set spline mirror handles to enabled by default

* refactor mirror setting into common function

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Chase
2023-04-27 19:21:20 +08:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent 1f5bfdc2e5
commit 0bac707241
3 changed files with 17 additions and 13 deletions
@@ -1,7 +1,8 @@
use crate::messages::portfolio::document::node_graph;
use crate::messages::portfolio::document::node_graph::VectorDataModification;
use crate::messages::prelude::*;
use bezier_rs::Subpath;
use bezier_rs::{ManipulatorGroup, Subpath};
use document_legacy::{LayerId, Operation};
use graph_craft::document::NodeNetwork;
use graphene_core::uuid::ManipulatorGroupId;
@@ -28,3 +29,15 @@ pub fn new_custom_layer(network: NodeNetwork, layer_path: Vec<LayerId>, response
);
responses.add(DocumentMessage::NodeGraphFrameGenerate { layer_path });
}
pub fn set_manipulator_mirror_angle(manipulator_groups: &Vec<ManipulatorGroup<ManipulatorGroupId>>, layer_path: &Vec<u64>, mirror_angle: bool, responses: &mut VecDeque<Message>) {
for manipulator_group in manipulator_groups {
responses.add(GraphOperationMessage::Vector {
layer: layer_path.clone(),
modification: VectorDataModification::SetManipulatorHandleMirroring {
id: manipulator_group.id,
mirror_angle,
},
});
}
}