Table of contents

Public interface

When dragging a handle, users can snap the handle to key geometry on other nearby shapes. Customize how handles snap to a shape by returning this from ShapeUtil.getHandleSnapGeometry.

Any co-ordinates here should be in the shape's local space.

Signature
interface HandleSnapGeometry {}
Source

packages/editor/src/lib/editor/managers/SnapManager/HandleSnaps.ts


Properties

outline

Public propertysignature

A Geometry2d that describe the outline of the shape that the handle will snap to - fills are ignored. By default, this is the same geometry returned by ShapeUtil.getGeometry. Set this to null to disable handle snapping to this shape's outline.

Signature
outline?: Geometry2d | null
References

Geometry2d


points

Public propertysignature

Key points on the shape that the handle will snap to. For example, the corners of a rectangle, or the centroid of a triangle. By default, no points are used.

Signature
points?: VecModel[]
References

VecModel


Methods

getSelfSnapOutline

Public methodsignature

By default, handles can't snap to their own shape because moving the handle might change the snapping location which can cause feedback loops. You can override this by returning a version of outline that won't be affected by the current handle's position to use for self-snapping.

Parameters
NameDescription

handle

TLHandle
Returns
Geometry2d | null
References

TLHandle, Geometry2d


getSelfSnapPoints

Public methodsignature

By default, handles can't snap to their own shape because moving the handle might change the snapping location which can cause feedback loops. You can override this by returning a version of points that won't be affected by the current handle's position to use for self-snapping.

Parameters
NameDescription

handle

TLHandle
Returns
VecModel[]
References

TLHandle, VecModel


HALF_PIhardReset