Skip to content

Custom guides support and refactor of snapping and distance guides plugins #1041

@jesusmpc

Description

@jesusmpc

Description

Refactor the current snapping and distance guide plugin to support custom guide sources, improve extensibility, and unify guide rendering/calculation logic across viewport, objects, and user-defined guides.

The current implementation tightly couples snapping logic with built-in stage/object bounds and makes it difficult to:

  • introduce custom alignment guides,
  • extend snapping behavior,
  • reuse guide calculations,
  • or support more advanced layout workflows.

This refactor should introduce a modular guide architecture that supports:

  • built-in guides,
  • custom guides,
  • configurable snapping rules,
  • and reusable distance/visibility calculations.

Goals

1. Custom Guide Support

Allow consumers to register custom guides dynamically.

Examples:

  • canvas center lines,
  • layout grids,
  • safe areas,
  • artboard margins,
  • ruler guides,
  • user-created alignment lines,
  • section/container boundaries.

Custom guides should:

  • participate in snapping,
  • optionally render as visual guides,
  • support horizontal and vertical directions,

2. Refactor Snapping Engine

Decouple snapping calculations from rendering and node traversal. Also unify snapping in a single central point.

Current issues:

  • duplicated guide calculations,
  • viewport/object snapping mixed together,
  • difficult to extend snapping targets,
  • inconsistent snapping resolution,
  • limited composability.

The refactor should:

  • normalize all guides into a shared structure,
  • centralize snapping resolution,
  • support multiple guide providers,
  • simplify future feature additions.

3. Unified Distance Guide System

Distance guides should use the same guide infrastructure as snapping.

Requirements:

  • shared bounding-box visibility calculations,
  • reusable overlap/intersection utilities,
  • viewport-aware guide rendering,
  • support partially visible objects,
  • predictable priority resolution.

Distance calculations should work consistently with:

  • transformed nodes,
  • zoom/pan,
  • rotated groups,
  • clipped viewport intersections.

Expected Outcome

After refactor:

  • snapping becomes provider-based and extensible,
  • custom guides are first-class citizens,
  • distance guides reuse shared geometry logic,
  • viewport visibility handling is consistent,
  • and future guide-related features become easier to implement and maintain.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions