Skip to content

Conversation

@krVatsal
Copy link

@krVatsal krVatsal commented Nov 4, 2025

Add a new arrow shape tool

Closes #3317

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>
@krVatsal krVatsal marked this pull request as draft November 4, 2025 11:46
@timon-schelling
Copy link
Member

!build

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

📦 Build Complete for 989f4ba
https://8e0fa0ab.graphite.pages.dev

@timon-schelling
Copy link
Member

I know still a draft, but a arrow node might be something to consider. Like it is done for all other shapes.

Thanks for the contribution :)

@Keavon
Copy link
Member

Keavon commented Nov 4, 2025

I haven't read the (draft) PR's code, but what is the tooling doing if it's not controlling an arrow generator node?

@timon-schelling
Copy link
Member

the (draft) PR's code, but what is the tooling doing if it's

creating a path node

@Keavon
Copy link
Member

Keavon commented Nov 4, 2025

That wouldn't allow the user to parametrically edit the arrow shape. The goal is to add handles to drag its width, length, arrow head's front and back angles, and arrow head width and height. That all has to be written to the parameters of an Arrow node. @krVatsal please be aware of these details for the requirements of this feature. Thank you.

@krVatsal
Copy link
Author

krVatsal commented Nov 4, 2025

Sure @Keavon

let id = PointId::generate();
responses.add(GraphOperationMessage::Vector {
layer,
modification_type: VectorModificationType::InsertPoint { id, position: pos },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this inserts the point in layer space. You said above that you Build arrow in viewport space.

To convert between the viewport and the layer space, you can do something like:

document.metadata().transform_to_viewport(layer).inverse().transform_point2(pos)

Alternatively you can set the transform on the layer itself:

responses.add(GraphOperationMessage::TransformSet {
	layer,
	transform: DAffine2::IDENTITY,
	transform_in: TransformIn::Viewport,
	skip_rerender: false,
});

Note that the line tool is broken and produces offset lines when inside a transformed parent layer. I would recommend that you avoid implementing this bug into you new tool.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help, i have modified it accordingly.

Signed-off-by: krVatsal <kumarvatsal34@gmail.com>
@github-actions
Copy link

📦 Build Complete for f3b1179
https://828f1024.graphite.pages.dev

@timon-schelling
Copy link
Member

The arrow position is correct now, I would prefer if it was flipped though, starting at the base and dragging to the tip (just my opinion).

And reminder about the requirement of a new arrow node. Just a path node with arrow data generated by the tool is not enough. Take another look at other shape nodes (like Regular Polygon in the Image).

image

That wouldn't allow the user to parametrically edit the arrow shape. The goal is to add handles to drag its width, length, arrow head's front and back angles, and arrow head width and height. That all has to be written to the parameters of an Arrow node. @krVatsal please be aware of these details for the requirements of this feature. Thank you.

@krVatsal
Copy link
Author

The arrow position is correct now, I would prefer if it was flipped though, starting at the base and dragging to the tip (just my opinion).

And reminder about the requirement of a new arrow node. Just a path node with arrow data generated by the tool is not enough. Take another look at other shape nodes (like Regular Polygon in the Image).

image > That wouldn't allow the user to parametrically edit the arrow shape. The goal is to add handles to drag its width, length, arrow head's front and back angles, and arrow head width and height. That all has to be written to the parameters of an Arrow node. @krVatsal please be aware of these details for the requirements of this feature. Thank you.

Got it, I'll fix it soon!

@krVatsal krVatsal marked this pull request as ready for review November 11, 2025 05:28
@timon-schelling
Copy link
Member

!build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an arrow to the Shape tool

4 participants