-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: joining paths from different layers with Ctrl+J fails #3534
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
base: master
Are you sure you want to change the base?
fix: joining paths from different layers with Ctrl+J fails #3534
Conversation
|
Hello and thanks for the PR. I need to mention that we do not accept PR descriptions written by AI because they increase the noise-to-signal ratio and usually serve to mislead with obscured inaccuracies. (The same applies to code, which must be written by you.) |
|
Oh, hey , I had this extension turned on in my IDE https://whatthediff.ai/ , will be mindful to disable it when creating PRs in this repo :) . Also regarding using AI in code, I did use claude code for targeting the files and the fix but did review that intensively before publishing . |
|
Thanks for the insight into your process (we've been seeing more highly-elaborate-but-not-insightful PR descriptions like this and it's good to know some of the details about what kinds of AI tools are producing them). For code authorship, AI is acceptable for auto-completing lines you would already be typing, but we need contributions to always come from the original thought processes of its human authors who can answer to the reasoning behind each line of changes. Code can't be mysteriously changed without anyone aware of why the change was made. Thanks for working to follow our requirements to building an effective software project. |
0HyperCube
left a comment
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.
It doesn't work. I have tried it with some simple lines with a transform.
I guess the vibes haven't fully completed the code.
cannot_join_lines_with_transform.mp4
|
Taking a look |
When using Ctrl+J to join two points from different layers, the operation failed because PointIds change during merge due to collision resolution. The fix uses index-based point tracking instead of PointIds: 1. Before merge: Record the index of each selected point in its layer 2. Calculate post-merge indices using the point offset from layer1 3. After merge: Retrieve the actual PointIds at those indices 4. Create the connecting segment using the resolved PointIds This works because Vector::concat() preserves point ordering during merge, so we can use exact index arithmetic to find points after remapping. Fixes GraphiteEditor#3519
27f0b7b to
d604ef6
Compare
|
After taking a second look at the issue, here is what I came up with: The fix uses index-based tracking to handle PointId remapping:
Other approaches I considered:
|
|
Let me know if I am missing something or if there could be any other edge case here |
Screen.Recording.2025-12-28.at.7.12.43.AM.movMore manual testing with data grid for when the conflicting PointId is not updated so the wrong segment is created , here it is not created . |
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.
fail_with_repeat.mp4
However I guess it doesn't matter too much.
6ad186a to
2b7e6e6
Compare
| let mut start_point_id = None; | ||
| let mut end_point_id = None; | ||
|
|
||
| for (i, &pos) in positions.iter().enumerate() { |
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.
I don't think this for loop is an overhead here, realistically there would'nt be more than 100-200 points max here . Thats just my guess , can definitely have a hashmap here as well
|
I have a better solution for this, let me code it up So basically the issue with the current approach was when layers use the repeat modifier. The merge operation flattens repeated instances, breaking the expected point array structure. Expected behavior:
Actual behavior with repeat:
Since the old approach calculated indices using end_index = end_idx + layer1_count, it assumed layer1_count = 2, but after flattening the repeated instances, layer1 actually contributes 6 points. This causes the lookup to select the wrong points. Instead of relying on indices (which change when instances are flattened), we now:
|
screenrecording.graphite.mp4Some manual testing after the recent commit |
|
let me know if any other changes are required |
screenrecording.graphite.mp4
Fixes #3519