Community Bonding
Since this period is a part of the GSoC community bonding period, I spent much of my time going through the codebase and trying to understand how existing implementation of snapping works and asking the community what I do not understand.
Adding Preferences
Currently snapping prefferences reside in the Document Properties Dialog under the Snap tab. So the first thing I added was a category called ”Alignment Snapping” to that dialog.
Alignment Snapper Class
Inkscape already uses a class named ObjectSnapper
to snap point on objects to other
objects. This class is the base on top of which I build. So I wrote a very rudimentary
implementation of an AlignmentSnapper
class that allows aligning objects to nearby objects.
This is still a very early stage in implementation and is far from ready. There is
a lot that needs to be optimised for example ObjectSnapper
and AlignmentSnapper
can
benifit from sharing data with each other.
Having said that, here is a list of things that work and things that don’t!
What Works
- Snapping to corners, center and edge midpoints of other object’s bounding box
- PreSnapping tools to draw aligned objects
- Snapping to page corners and midpoint if Toggle Snapping to Page Border option is enabled
- While editing paths nodes snap to the nodes in the object and bounding boxes of other objects
- Set Alignment tolerance in the Document Properties dialog
Known Bugs
- Source object’s nodes are snapped instead of its bounding box points
- While editing paths, the snapping is not as responsive
SnapIndicator
has not been updated so it uses the existing implementation and
give a warning and shows UNDEFINED
snap type.
No toggles have been implemented as of now.
Next Up
Since now I have basic Smart Snapping working more or less how I would want it
to work like, the next step would be to discuss with #team_ux how exactly we want
this feature to behave, what should be the different settings and toggle options.
Apart from this the next major step would be to extend the SnapIndicator
class.