Add an arrow to the Shape tool (#3343)

* add arrow shape feature in editor

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* fix the arrow tool to show arrow in viewport space

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* fix the direction of arrow and make the new arrow node

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* updated arrow tool to hae start and end points

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* fixed calculate point bug

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* fixed some bugs of arrow positioning

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* fixed formatting in whole codebase and added fill to arrow

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>

* fix

---------

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>
Co-authored-by: Timon <me@timon.zip>
This commit is contained in:
Vatsal Kumar
2026-01-12 06:28:28 +05:30
committed by GitHub
parent 479688d86b
commit 4fea2b0fe7
7 changed files with 186 additions and 8 deletions

View File

@@ -188,16 +188,26 @@ fn star<T: AsU64>(
/// Generates a line with endpoints at the two chosen coordinates.
#[node_macro::node(category("Vector: Shape"))]
fn line(
fn arrow(
_: impl Ctx,
_primary: (),
/// Coordinate of the line's initial endpoint.
#[default(0., 0.)]
start: PixelSize,
/// Coordinate of the line's terminal endpoint.
#[default(100., 100.)]
end: PixelSize,
#[default(0., 0.)] start: PixelSize,
#[default(100., 0.)] end: PixelSize,
#[unit(" px")]
#[default(10)]
shaft_width: f64,
#[unit(" px")]
#[default(30)]
head_width: f64,
#[unit(" px")]
#[default(20)]
head_length: f64,
) -> Table<Vector> {
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_arrow(start, end, shaft_width, head_width, head_length)))
}
#[node_macro::node(category("Vector: Shape"))]
fn line(_: impl Ctx, _primary: (), #[default(0., 0.)] start: PixelSize, #[default(100., 100.)] end: PixelSize) -> Table<Vector> {
Table::new_from_element(Vector::from_subpath(subpath::Subpath::new_line(start, end)))
}