Table of contents

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.

interface HandleSnapGeometry {}

Properties

outline

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.

outline?: Geometry2d | null

points

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.

points?: VecModel[]

Methods

getSelfSnapOutline

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

getSelfSnapPoints

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[]

Geometry2dOptionsLoadingScreenProps