Skip to content

Commit 353d2ff

Browse files
committed
WIP attempt to integrate skew
1 parent e1a6ffa commit 353d2ff

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,15 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
22552255
..Default::default()
22562256
}),
22572257
),
2258-
PropertiesRow::with_override("Skew", WidgetOverride::Hidden),
2258+
PropertiesRow::with_override(
2259+
"Skew",
2260+
WidgetOverride::Vec2(Vec2InputSettings {
2261+
x: "X".to_string(),
2262+
y: "Y".to_string(),
2263+
unit: "°".to_string(),
2264+
..Default::default()
2265+
}),
2266+
),
22592267
PropertiesRow::with_override("Pivot", WidgetOverride::Hidden),
22602268
],
22612269
output_names: vec!["Data".to_string()],

editor/src/messages/tool/tool_messages/select_tool.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::consts::{
66
SELECTION_DRAG_ANGLE, SELECTION_TOLERANCE,
77
};
88
use crate::messages::input_mapper::utility_types::input_mouse::ViewportPosition;
9+
use crate::messages::portfolio::document::graph_operation::transform_utils;
910
use crate::messages::portfolio::document::graph_operation::utility_types::{ModifyInputsContext, TransformIn};
1011
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
1112
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
@@ -23,7 +24,6 @@ use crate::messages::tool::common_functionality::transformation_cage::*;
2324
use crate::messages::tool::common_functionality::{auto_panning::AutoPanning, measure};
2425

2526
use bezier_rs::Subpath;
26-
use graph_craft::document::value::TaggedValue;
2727
use graph_craft::document::NodeId;
2828
use graphene_core::renderer::Quad;
2929
use graphene_core::text::load_face;
@@ -535,15 +535,9 @@ impl Fsm for SelectToolFsmState {
535535
if let Some(node) =
536536
ModifyInputsContext::locate_node_in_layer_chain("Transform", layer, &document.network_interface).and_then(|node_id| document.network_interface.document_node(&node_id, &[]))
537537
{
538-
if let (Some(&TaggedValue::F64(angle)), Some(&TaggedValue::DVec2(skew))) = (node.inputs[2].as_value(), node.inputs[3].as_value()) {
539-
// TODO: Figure out and fix why this incorrectly applies the rotation twice if it's a leaf layer (VectorData, ImageFrame, etc. rather than a group)
540-
return DAffine2::from_angle(angle) * transform;
541-
542-
// TODO: Include skew in the transform cage, since rotation and skew are the two parts that affect the basis for the space in which the bounding box is calculated
543-
// let mut skew_matrix = DAffine2::IDENTITY;
544-
// skew_matrix.matrix2.x_axis[0] = skew.x.tan();
545-
// skew_matrix.matrix2.y_axis[1] = skew.y.tan();
546-
}
538+
// TODO: Figure out and fix why this incorrectly applies the rotation twice if it's a leaf layer (VectorData, ImageFrame, etc. rather than a group)
539+
let transform_node_transformation = transform_utils::get_current_transform(node.inputs.as_slice());
540+
return transform_node_transformation * transform;
547541
};
548542

549543
transform

0 commit comments

Comments
 (0)