Skip to content
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

Support for deleting points to break path #1593

Merged
merged 9 commits into from
Feb 5, 2024

Conversation

zhiyuang
Copy link
Contributor

@zhiyuang zhiyuang commented Feb 2, 2024

Closes #1550

Only handle the closed path case and support only delete one anchor right now.

Select a anchor, then Ctrl + Delete to break

@Keavon
Copy link
Member

Keavon commented Feb 2, 2024

I'm very glad to see this, thank you! I'll review it in detail ASAP, although I'm behind on my reviews because I've been focusing on some things with short-term deadlines. Most likely this weekend though I'll be able to do do the remaining reviews. Thanks for your patience and continued work on these while you're waiting on them to get merged, I promise the PRs won't get abandoned!

@Keavon
Copy link
Member

Keavon commented Feb 2, 2024

!build

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 2, 2024

thanks, take your time. I'm still diving into the codebase and contributing some codes during the process 😆

Copy link

github-actions bot commented Feb 2, 2024

📦 Build Complete for 38ecaef
https://602b69b2.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Feb 2, 2024

Just some quick comments about the behavior:

Eventually we'll have a menu, similar to Blender's X hotkey menu, that will let the user choose how to delete or dissolve the selection. But for now we'll rely on hotkeys. What I had in mind was that CtrlDelete would delete the selected point but also the adjacent segments. However the behavior you implemented, where it breaks it but keeps the adjacent segments, is still useful and I think assigning it to CtrlShiftDelete would be the best, until we eventually get around to building the X hotkey menu (which will require some frontend work and refactoring from me to build context menus).

Also, when breaking these points, it'd be nice to have their other handle be removed (equivalent to selecting it and hitting Delete). So instead of this being what you see after breaking the point and separating them a bit:

image

I'd like to see this instead:

image

Lastly, it would be useful if it was also possible to break/delete an anchor that's part of an already open shape. Doing this would result in two separate subpaths.

Hopefully those suggestions would be easy enough to tweak. This is all looking good and is very useful, so thank you for doing it!

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 2, 2024

thanks for the detailed comments. I will try to change the hotkeys and delete handles first.

For delete an anchor for open shape, I also thought about it. After deleting the anchor on an open curve, would we expect two break parts to be in one layer or two separate layers? I have tried in Inscape, they will create a new layer to draw the new break part.

@Keavon
Copy link
Member

Keavon commented Feb 2, 2024

For the moment I haven't made up my mind which is likely to be better. The idea of subpaths is that a layer can contain multiple of them. They're used, for example, to create a donut shape where there's an outer circle as one subpath and an inner circle as the other subpath (and since they have opposite winding directions, the inner one is drawn as a hole). It's probably easier for you to make them subpaths so I'd suggest you go with that option. This also would make it possible for people to actually create subpaths which isn't possible right now through any other means. But it splitting into two layers would also be acceptable. We may also want to eventually add a menu action that can split subpaths into individual layers. Or perhaps another to combine multiple selected layers into subpaths of one layer.

@Keavon
Copy link
Member

Keavon commented Feb 3, 2024

Please ping me when you've had the chance to complete each of the suggestions I made and I'll be ready to jump back into reviewing and merging this. Thanks!

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 4, 2024

  • Key mapping change to Ctrl Shift Delete
  • Remove break point's one-side handle
  • Break an open path (in progress)

I had a initial try to handle breaking an open path yesterday, I chose to break them as subpaths in a layer. But met a weired issue that both subpaths are always moved together. I will spend more time today to see how to solve this and do some tests. Will let you know once done.

@Keavon
Copy link
Member

Keavon commented Feb 4, 2024

Could you post a video of how both subpaths were being moved together?

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 4, 2024

Screen.Recording.2024-02-04.at.09.44.14.mov

@Keavon
Copy link
Member

Keavon commented Feb 4, 2024

Ah, yes, gotcha. Pay close attention to which anchor points are selected (when they're filled with blue), we have it so when you click on a shape with the Path tool, it becomes fully selected by default so it's easily draggable. But now that we are actually using multiple subpaths within a layer, we would like to update that behavior so it only selects all the anchors of the subpath you click on, not all anchors from all subpaths. However, if you prefer to work on that in a separate PR, that could be deferred (the choice is yours).

@Keavon
Copy link
Member

Keavon commented Feb 4, 2024

There is one more bullet point to add to your list, by the way, if you don't mind implementing it too:

  • CtrlDelete should delete the anchor and both its adjacent segments

Thanks :)

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 4, 2024

Oh, you give good hints on the issue. I could spend more time on this PR. And add a new to-do in the list 😄 .

  • Key mapping change to Ctrl Shift Delete
  • Remove break point's one-side handle
  • Break an open path (in progress)
  • Ctrl Shift should delete the anchor and both its adjacent segments

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 4, 2024

@Keavon do we have an existing function to check if the mouse click on a subpath?

@Keavon
Copy link
Member

Keavon commented Feb 4, 2024

I'll have to ask @0HyperCube if he knows, I'm not sure.

@0HyperCube
Copy link
Member

@Keavon do we have an existing function to check if the mouse click on a subpath?

@zhiyuang for the select tool, we use ClickTarget::intersect_rectangle.

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 4, 2024

  • Key mapping change to Ctrl Shift Delete
  • Remove break point's one-side handle
  • Break an open path (support break at multi points simultaneously)
  • Ctrl Delete should delete the anchor and both its adjacent segments (support break at multi points simultaneously)

@Keavon Break path related to-dos should have been finished, you could have a code review when you have time. Subpath selection issue I could open another PR to fix, let this PR stays on path break related changes.

@Keavon
Copy link
Member

Keavon commented Feb 4, 2024

!build

@Keavon Keavon changed the title Break a closed curve Add deleting points on path to break path Feb 4, 2024
Copy link

github-actions bot commented Feb 4, 2024

📦 Build Complete for 45dec05
https://10bfd8ff.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Feb 4, 2024

Wonderful work on this PR (and your other PRs)!

Just starting my QA testing now and noticed this:

I'm seeing a bug with the handles when I use the CtrlShiftDelete version. When you draw an ellipse and perform that on one of its points, this is the result:

image

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 5, 2024

This is a case has been broken after I refactor some code. Have been fixed.

@zhiyuang
Copy link
Contributor Author

zhiyuang commented Feb 5, 2024

And I find Ctrl+Delete also has this issue

image

@Keavon Keavon changed the title Add deleting points on path to break path Support for deleting points to break path Feb 5, 2024
@Keavon Keavon merged commit a412a77 into GraphiteEditor:master Feb 5, 2024
2 checks passed
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 ability to break a closed curve to be open
3 participants