HandleSnapGeometry

See source code
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

optional

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

optional

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

optional

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

Returns

Geometry2d | null

getSelfSnapPoints

optional

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

Returns


Prev
Geometry2dOptions
Next
LoadingScreenProps