mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 05:18:12 +08:00
New node: Dimensions (#2576)
* Add node for size of bounding box * Keep rustfmt happy --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
9a62c1c089
commit
a94354df04
@@ -954,6 +954,16 @@ async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTa
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
|
||||||
|
async fn dimensions(_: impl Ctx, vector_data: VectorDataTable) -> DVec2 {
|
||||||
|
let vector_data_transform = vector_data.transform();
|
||||||
|
let vector_data = vector_data.one_instance().instance;
|
||||||
|
vector_data
|
||||||
|
.bounding_box_with_transform(vector_data_transform)
|
||||||
|
.map(|[top_left, bottom_right]| bottom_right - top_left)
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
#[node_macro::node(category("Vector"), path(graphene_core::vector), properties("offset_path_properties"))]
|
#[node_macro::node(category("Vector"), path(graphene_core::vector), properties("offset_path_properties"))]
|
||||||
async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, line_join: LineJoin, #[default(4.)] miter_limit: f64) -> VectorDataTable {
|
async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, line_join: LineJoin, #[default(4.)] miter_limit: f64) -> VectorDataTable {
|
||||||
let vector_data_transform = vector_data.transform();
|
let vector_data_transform = vector_data.transform();
|
||||||
|
|||||||
Reference in New Issue
Block a user