mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 15:28:12 +08:00
* 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:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
1f5bfdc2e5
commit
0bac707241
@@ -1,7 +1,8 @@
|
|||||||
use crate::messages::portfolio::document::node_graph;
|
use crate::messages::portfolio::document::node_graph;
|
||||||
|
use crate::messages::portfolio::document::node_graph::VectorDataModification;
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
|
||||||
use bezier_rs::Subpath;
|
use bezier_rs::{ManipulatorGroup, Subpath};
|
||||||
use document_legacy::{LayerId, Operation};
|
use document_legacy::{LayerId, Operation};
|
||||||
use graph_craft::document::NodeNetwork;
|
use graph_craft::document::NodeNetwork;
|
||||||
use graphene_core::uuid::ManipulatorGroupId;
|
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 });
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::messages::frontend::utility_types::MouseCursorIcon;
|
use crate::messages::frontend::utility_types::MouseCursorIcon;
|
||||||
use crate::messages::input_mapper::utility_types::input_keyboard::{Key, MouseMotion};
|
use crate::messages::input_mapper::utility_types::input_keyboard::{Key, MouseMotion};
|
||||||
use crate::messages::layout::utility_types::layout_widget::PropertyHolder;
|
use crate::messages::layout::utility_types::layout_widget::PropertyHolder;
|
||||||
use crate::messages::portfolio::document::node_graph::VectorDataModification;
|
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use crate::messages::tool::common_functionality::resize::Resize;
|
use crate::messages::tool::common_functionality::resize::Resize;
|
||||||
@@ -130,17 +129,7 @@ impl Fsm for EllipseToolFsmState {
|
|||||||
let subpath = bezier_rs::Subpath::new_ellipse(DVec2::ZERO, DVec2::ONE);
|
let subpath = bezier_rs::Subpath::new_ellipse(DVec2::ZERO, DVec2::ONE);
|
||||||
let manipulator_groups = subpath.manipulator_groups().to_vec();
|
let manipulator_groups = subpath.manipulator_groups().to_vec();
|
||||||
graph_modification_utils::new_vector_layer(vec![subpath], layer_path.clone(), responses);
|
graph_modification_utils::new_vector_layer(vec![subpath], layer_path.clone(), responses);
|
||||||
|
graph_modification_utils::set_manipulator_mirror_angle(&manipulator_groups, &layer_path, true, responses);
|
||||||
// Set the four manipulator groups to have their handle angles mirrored by default
|
|
||||||
for manipulator_group in manipulator_groups {
|
|
||||||
responses.add(GraphOperationMessage::Vector {
|
|
||||||
layer: layer_path.clone(),
|
|
||||||
modification: VectorDataModification::SetManipulatorHandleMirroring {
|
|
||||||
id: manipulator_group.id,
|
|
||||||
mirror_angle: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the fill color to the primary working color
|
// Set the fill color to the primary working color
|
||||||
responses.add(GraphOperationMessage::FillSet {
|
responses.add(GraphOperationMessage::FillSet {
|
||||||
|
|||||||
@@ -264,7 +264,9 @@ fn add_spline(tool_data: &SplineToolData, global_tool_data: &DocumentToolData, s
|
|||||||
let subpath = bezier_rs::Subpath::new_cubic_spline(points);
|
let subpath = bezier_rs::Subpath::new_cubic_spline(points);
|
||||||
|
|
||||||
let layer_path = tool_data.path.clone().unwrap();
|
let layer_path = tool_data.path.clone().unwrap();
|
||||||
|
let manipulator_groups = subpath.manipulator_groups().to_vec();
|
||||||
graph_modification_utils::new_vector_layer(vec![subpath], layer_path.clone(), responses);
|
graph_modification_utils::new_vector_layer(vec![subpath], layer_path.clone(), responses);
|
||||||
|
graph_modification_utils::set_manipulator_mirror_angle(&manipulator_groups, &layer_path, true, responses);
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::StrokeSet {
|
responses.add(GraphOperationMessage::StrokeSet {
|
||||||
layer: layer_path.clone(),
|
layer: layer_path.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user