Skip to content

Support for deleting points to break path - #1593

Merged
Keavon merged 9 commits into
GraphiteEditor:masterfrom
zhiyuang:feature-closed-curve-break
Feb 5, 2024
Merged

Support for deleting points to break path#1593
Keavon merged 9 commits into
GraphiteEditor:masterfrom
zhiyuang:feature-closed-curve-break

Conversation

@zhiyuang

@zhiyuang zhiyuang commented Feb 2, 2024

Copy link
Copy Markdown
Contributor

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

Keavon commented Feb 2, 2024

Copy link
Copy Markdown
Member

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

Keavon commented Feb 2, 2024

Copy link
Copy Markdown
Member

!build

@zhiyuang

zhiyuang commented Feb 2, 2024

Copy link
Copy Markdown
Contributor Author

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

@github-actions

github-actions Bot commented Feb 2, 2024

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

@Keavon

Keavon commented Feb 2, 2024

Copy link
Copy Markdown
Member

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

zhiyuang commented Feb 2, 2024

Copy link
Copy Markdown
Contributor Author

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

Keavon commented Feb 2, 2024

Copy link
Copy Markdown
Member

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

Keavon commented Feb 3, 2024

Copy link
Copy Markdown
Member

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

zhiyuang commented Feb 4, 2024

Copy link
Copy Markdown
Contributor Author
  • 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

Keavon commented Feb 4, 2024

Copy link
Copy Markdown
Member

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

@zhiyuang

zhiyuang commented Feb 4, 2024

Copy link
Copy Markdown
Contributor Author
Screen.Recording.2024-02-04.at.09.44.14.mov

@Keavon

Keavon commented Feb 4, 2024

Copy link
Copy Markdown
Member

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

Keavon commented Feb 4, 2024

Copy link
Copy Markdown
Member

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

zhiyuang commented Feb 4, 2024

Copy link
Copy Markdown
Contributor Author

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

zhiyuang commented Feb 4, 2024

Copy link
Copy Markdown
Contributor Author

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

@Keavon

Keavon commented Feb 4, 2024

Copy link
Copy Markdown
Member

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

@0HyperCube

Copy link
Copy Markdown
Contributor

@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

zhiyuang commented Feb 4, 2024

Copy link
Copy Markdown
Contributor Author
  • 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
Keavon force-pushed the feature-closed-curve-break branch from 2e6b0c0 to 45dec05 Compare February 4, 2024 17:16
@Keavon

Keavon commented Feb 4, 2024

Copy link
Copy Markdown
Member

!build

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

github-actions Bot commented Feb 4, 2024

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

@Keavon

Keavon commented Feb 4, 2024

Copy link
Copy Markdown
Member

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

@Keavon
Keavon force-pushed the feature-closed-curve-break branch from 1046cf3 to ce131b2 Compare February 5, 2024 01:46
@zhiyuang

zhiyuang commented Feb 5, 2024

Copy link
Copy Markdown
Contributor Author

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

@zhiyuang

zhiyuang commented Feb 5, 2024

Copy link
Copy Markdown
Contributor Author

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
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