Skip to content

GSoC 2021 OnCanvas Alignment Snapping

Parth Pant requested to merge ParthPant/inkscape:alignment-guides into master

Related Merge Requests

Release Notes: https://wiki.inkscape.org/wiki/Release_notes/1.2#Canvas

A little blog I made to track progress: https://parthpant.github.io

OnCanvas Alignment Guides are Horizontal or Vertical lines that only appear when you're editing objects on the canvas. They provide more contextual information about and objects X/Y position relative to other nearby objects. As you get closer to align the selection with the edge of another nearby object, the selection will automatically snap to that position and an Alignment Guide that coincides with the (now aligned) edges will appear to indicate that a snap has indeed occurred. This guide can be in vertical or horizontal direction depending on the optimum snap found.

Distribution Guides are spacing guides that appear in between equally spaced objects. These guides make it easier to place objects at equal distance from each other. These guides also appear in horizontal or vertical direction based on the optimum snap position.

What Works

  • Snapping to corners, center and edge midpoints of other object's bounding box
  • Other Snap positions are preferred over alignment snap positions even if they are closer
  • PreSnapping tools to draw aligned objects
  • Toggle Alignment Snapping option in Snap Controllers Toolbar
  • Toggle snapping to other nodes in the same path while editing paths as a sub-option
  • 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
  • Other potential snap positions are given priority over Alignment snapping even if they are further away from the source.
  • Alignment snapping works only with items visible in the viewport
  • When holding Ctrl and moving and object alignment snapping occurs only in the perpendicular direction (eg. When only moving in Vertical direction, item are only Horizontally aligned)

Known Bugs

  • The upper-left corner of any object is only alignment snapped. (try snapping the upper left corner of a rect to the corner of any other rect)
  • While stretching an object, alignment snapping works only if the corner point handels are dragged (try dragging the edge mid point handels)
  • Alignment sanpping does not work while drawing paths with the pen tool (missing feature)
  • Snap Indicators do not disappear completely while PreSnap and sometimes the lines are not fully drawn

SnapIndicator has not been updated so it uses the existing implementation and give a warning and shows UNDEFINED snap type.

alignment

Edited by Parth Pant

Merge request reports