Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.98 KB

snapping-thoughts.md

File metadata and controls

38 lines (30 loc) · 1.98 KB

Snapping

modes (?):

  • Snap to grid and vertices only (no shift)
  • Snap to grid, vertices, 'synthetic' points, edges, (sizes, midpoints?)

considerations:

  • On moving a polygon we need to snap with awareness of all verts on polygon.
  • should the eraser snap?
  • Snapping to an edge, or to 'synthetic' points, should only restrict a single dimension: line snapping.
  • try to satisfy multiple constraints at once (eg, a line and a point)?
  • pixels are probably the wrong dimensions to use for these calculations (hard to tell which is a grid component)
  • Snapping to both crooked edge and grid point. Might not intersect except at endpoints of edges. Do we snap to intersection with grid line? (not just grid point?) https://trello-attachments.s3.amazonaws.com/58d428743111af1d0a20cf28/599b11844353e9e75f6c9c8b/5cd57f09b6c2e8721dde4b62a9dad5dc/capture.png
  • synthetic edges only for rectangles

SnapTarget:

  • dx, dy offsets from cursor position (only one of these for edges? what about diagonal edges? maybe something like (5 + 4t, 3 + 2t)? Am I writing a prolog?)
  • distance
  • x, y absolute positions (for high lighting)
  • type? (gridpoint, vertex, edge, synthetic edge)

snapTargets(vertices, gridSpacing, location) -> [SnapTarget]

  • consider nearby grid points and (nearby?) existing vertices
  • for each one, find the dx, dy necessary to bring us to that location
  • sort by magnitude of vector
  • can multiple be satisfied?
  • (allow tab-ing between options?)

highlightSnapTarget(snapTarget)

  • emphasize the absolute position of that target

on click, choose the currently highlighted snap target?

Examples