Replies: 2 comments 3 replies
-
Thank you so much for this! Don't worry too much about the coding language, converting C++/Qt to Vala is not too hard, so having a working reference is incredibly helpful. I think your approach so far is correct, and it emulates what other professional apps do (Figma, Sketch, Adobe XD). Some info to your points:
We don't need to do that in Akira because the
Also for these cases, Multi-selection is also not a problem because we already have a This is very exciting! |
Beta Was this translation helpful? Give feedback.
-
Ok, finished implementing snapping in my prototype. I'm actually fairly happy with it. It's made out of for loops, which is obvious room for improvement--but still so performant that I don't think it matters too much. At 100,000 bounding boxes with 5 snapping points, it takes 1-3 ms. For a 2-night session build it's pretty ok. Also, did 4px snapping sensitivity, and I feel really good about it. I do think it's possible that some scoring based on mouse proximity could be interesting, and other layers of snapping (spacing) could be added...but I don't feel like it really makes that big of a difference. I'll try to see if I can get Akira building properly to see if I can add these features. |
Beta Was this translation helpful? Give feedback.
-
Hey guys!
Prelude (tl;dr)
I didn't know how to fit this into the guidelines about issues. I love the idea of what Akira is trying to be, but have reservations about contributing due to some topics I want to avoid (vala, etc). Please close this issue if this is found to be inappropriate or unhelpful.
I figured it may be interesting to contribute by way of making reference implementations for features that will be useful to the project. My idea is to eventually apply these references to make something more interesting--but yeah. You guys have a million things to think about, and maybe I could help out making these references to relieve some of that preliminary ideation and prototyping. And in general the they could serve as platforms for discussion.
I don't discard the possibility of doing actual Akira implementations, but I'm not there yet anyway.
Snapping
With that in mind, I was thinking about snapping. I went to bed a few nights ago playing around in my mind with some possible implementations. Without looking to see if there is something out there that may help (classic), last night I wrote a quick prototype for the first part of the problem.
Please excuse the code, I wrote in a few hours...also, I use Qt primitives (QRect) but changing it to generic ones would be trivial.
Screenshot of current state:
The main idea is:
Considerations
In the code, the rectangles I deal with would be bounding boxes--so it is generic in that sense.
I've been trying to think if I will need to keep information about the bounding boxes I snap to.
Not sure how hard the snapping heuristics are going to be. It should take me one more small session of work to get them into the current prototype, and that should give me an idea.
Originally I was thinking of several ways of partitioning space to make this faster...but it's so fast, even at ridiculous number of bounding boxes, that I'm not sure it's worth the trouble--unless a lot of extra context is added.
Transformations and multi-selections should be really easy to add to this. It just requires smarter generation of snapping points, otherwise the code is fairly agnostic to it.
Code
Here is a link to the implementation written in c++17 and qt.
https://gitlab.com/mbfraga/grid_snapping
Epilogue
If you got here, thanks for reading! Let me hear any thoughts or ideas. I'm really having fun playing around with this--even if it turns out to be pointless (someone already wrote it) or completely suboptimal.
Now back to my lunch break!
Beta Was this translation helpful? Give feedback.
All reactions