mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-18 07:48:02 +08:00
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:
@@ -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)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user