-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Border radius #3203
Border radius #3203
Conversation
I'm going in hollidays until the 08/01/2024, so I posted this pull request though not yet fullly complete. TODO
Of course, feel free to complete some of those tasks while I'm away, and to give me feedback on some aspects. |
Pinned |
Hi @maxkfranz , I hope you had nice holidays. Could you please give me some advice on where to store pre-calculated results for rounded node shapes ?
|
Happy new year. Caching the values is a bit more complicated than the decision of where to store the points. They need to be invalidated in the same cycle as the other cached values. I'll get back to you with details in the next day or so. For edges, caching is probably worthwhile, but for nodes it probably doesn't make much difference. |
Reminder:
|
Some initial notes:
|
For the edges, I've managed to cache what is need I believe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a point to consider re. naming before we merge this in:
Looks reasonable. There are some minor linter errors to resolve. Are there any other tests or points of consideration before merging this in? |
The thing that worries me the most really is the rounded node shapes which are now less optimised than before because we are not caching the unit vectors, I was hoping to be able to cache the rounded corners themselves within the nodes. You said it was okay, but I'm a bit suprised because we are calculating them in 3 different functions for each round shapes, and potentially, if the user moves a node, we need to recalculate the roundness again and again to calculate the arrow head position using the intersection function. But if you say that's alright, I'm fine with it. |
Of course, it’s better to cache.However, the nodes have texture caching applied at a level above the points caching. So, the points only need to be recalculated for drawing when the texture cache misses.One area that would be affected is the hit tests, for determining when you click on a node, for instance.It’s up to you if you want to apply caching of the points now. I think it would be better with caching, but it could also be added later. Only people who use the new, custom border radius would be affected, right? If so, it’s suboptimal but not a regression.On Jan 12, 2024, at 05:22, Eliot Ragueneau ***@***.***> wrote:
The thing that worries me the most really is the rounded node shapes which are now less optimised than before because we are not caching the unit vectors, I was hoping to be able to cache the rounded corners themselves within the nodes.
You said it was okay, but I'm a bit suprised because we are calculating them in 3 different functions for each round shapes, and potentially, if the user moves a node, we need to recalculate the roundness again and again to calculate the arrow head position using the intersection function. But if you say that's alright, I'm fine with it.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Well no, with the current code, the new way to calculate corners is applied to all the rounded polygons, not just those for which the user specified the border radius. I did this to avoid having yet other shapes like "customisable-round-rectangle", and because the current implementation of the rounded shapes is failing when the width and the height are dissimilar. |
… + support corner-radius impact on cut-rectangle + fix outline for hexagons
I've implemented the node caching, it's a bit more dirty than the previous caching since it is at the node level instead of the abstract shape definition, but the cache is well being used whenever we can, and updated whenever we need. |
Looks great. Merged. If you'd like to add anything else to this feature, or you notice any issues, just let me know. |
I noticed while testing it that for In theory, users shouldn't put unnecessary control points, and these are unnecessary since they do not make the edge move in any way, but it can be confusing. Do you think I should prevent this issue from happening? Like by ignoring collinear points? Is it too late to fix it for next release? |
There are all sorts of cases where people can create invalid beziers. We print some warnings in the console for the worst cases that get detected with no additional computational cost (e.g. the bezier can't be drawn at all). If you think there can be an inexpensive check to detect this case, then we can either automatically correct the points or we can print a warning in the console. Someone might create collinear points when creating control points interactively. Consider the case where you have a few points and it's easier to just drag one point to be collinear rather than to delete it. That example demonstrates that autocorrection would generally be preferable.
We don't need to be too strict about the release date of 3.29.0. Let's consider 2024-02-12. Would that be enough time to add your proposed fix? |
yes that's probably more than enough, thanks a lot! |
Look forward to it |
It seems my new commits are not showing in this PR, so I'll create a new PR |
Associated issues:
New edge type: smooth-segments #3201
border-radius property for node shapes with rounded corners #3198
This PR adds border-radius support, both for rounded polygons and rounded rectangle
This PR adds
round-segments
&round-taxi
, as well as their respective radius propertiesChecklist
Author:
unstable
. Bug-fix patches can go on eitherunstable
ormaster
.Reviewers:
master
branch and theunstable
branch. Normally, this just requires cherry-picking the corresponding merge commit frommaster
tounstable
-- or vice versa.