-
-
Notifications
You must be signed in to change notification settings - Fork 980
Layer snapping #386
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
Layer snapping #386
Conversation
Deploying with
|
| Latest commit: |
8a28a78
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://07ef8fc4.graphite-master.pages.dev |
|
Wow, this is already working very nicely! I think a smaller snap value would be good though, it only needs a few pixels. I also added one item to your todo list above: snapping being-created shapes. |
|
This is looking awesome! Please reduce I also added a task to the list in this main post:
If you'd prefer that I do that, let me know and I can make a commit to do that in the next few days. Lastly, we'll need to eventually support snapping while creating lines with the Line Tool and points with the Pen Tool. If you'd prefer to merge first and address that in a later PR, that would be fine— up to you. Perhaps just the Line Tool, for now, might be easy to do first. Is there anything else that you know needs to be done before we begin code review and prepare to merge this? Thanks again for continuing to work on this during the past month of slow progress. Things will be picking up again in the next few weeks when I regain free time! |
Done
Done
Done
Thanks. I've marked it ready for review. |
|
Looks great! Thanks for humoring my pedantry @0HyperCube in that round of reviews. We should be good to merge but perhaps, since the weekend is now here, we can wait to see if @TrueDoctor has the chance to take a look with his superior Rust experience. But feel free to merge anytime. |
|
I am not really a fan of passing a mutable document to the tools, there should be relatively easy way to avoid having to do that. If I am missing crucial benefits of using a |
@TrueDoctor It is needed to cache the snap targets to avoid walking through the layer tree each frame. I am unsure where to put the cache without having pass a mutable reference to the document message handler to the tools. |
|
@0HyperCube Could you put the cache into the tool storage? |
|
@TrueDoctor Sure, done. |
|
Nice this looks promising, will take a final look and then you should be good to go |
| if ipp.keyboard.get(lock_ratio as usize) { | ||
| size = size.abs().max(size.abs().yx()) * size.signum(); | ||
| } | ||
| if ipp.keyboard.get(center as usize) { |
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.
Not at all your pr, just something I noticed:
Should we add a ipp.keyboard.is_presseed(key: Key) method?
TrueDoctor
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.
Looks good to me, great work
I am not sure if the tool storage is the best spot for it, since caching is a global system, not specific to one tool. The Select Tool is certainly the most obvious, but also the Path Tool will use it for snapping vertices, the G (grab) action will use it, and plenty others I'm not thinking of now. We could save that for a future refactor though, I'm just commenting this to mention it. Thoughts? @TrueDoctor @0HyperCube |
|
The main thing is that caching should not take place in the document itself and this is a fine solution for now. |
|
@Keavon The path tool snapping is already implemented with a separate cache in the above refactor. The cache is cleared after the tool is finished (i.e. when your line is created or when your grab is released) - this is because most of the snapping operations mutate the new snap targets. If the cache is empty then there are just 56 bytes of stack ( |
|
Sounds good. I'm happy to merge now. Do you want to have the honor of pushing the button? |
Closes #200
This change is