SnapManager
Table of contents
Public class
Signature
class SnapManager {}
Source
packages/editor/src/lib/editor/managers/SnapManager.ts
Constructor
Public constructor
Constructs a new instance of the SnapManager
class
Parameters
Name | Description |
---|---|
|
|
References
Properties
currentCommonAncestor
Public readonly property
Signature
get currentCommonAncestor(): TLShapeId | undefined
References
editor
Public readonly property
Signature
readonly editor: Editor
References
lines
Public readonly property
Signature
get lines(): SnapLine[]
References
outlinesInPageSpace
Public readonly property
Signature
get outlinesInPageSpace(): Vec2d[][]
References
snappablePoints
Public readonly property
Signature
get snappablePoints(): SnapPoint[]
References
snappableShapes
Public readonly property
Signature
get snappableShapes(): GapNode[]
snapPointsCache
Public readonly property
Signature
get snapPointsCache(): import('@tldraw/store').ComputedCache<
SnapPoint[],
TLShape
>
References
ComputedCache, SnapPoint, TLShape
snapThreshold
Public readonly property
Signature
get snapThreshold(): number
visibleGaps
Public readonly property
Signature
get visibleGaps(): {
horizontal: Gap[]
vertical: Gap[]
}
Methods
clear()
Public method
Signature
clear(): void
getSnappingHandleDelta()
Public method
Signature
getSnappingHandleDelta({
handlePoint,
additionalSegments,
}: {
handlePoint: Vec2d
additionalSegments: Vec2d[][]
}): null | Vec2d
Parameters
Name | Description |
---|---|
|
|
Returns
null | Vec2d
References
setLines()
Public method
Signature
setLines(lines: SnapLine[]): void
Parameters
Name | Description |
---|---|
|
|
Returns
void
References
snapResize()
Public method
Signature
snapResize({
initialSelectionPageBounds,
dragDelta,
handle: originalHandle,
isAspectRatioLocked,
isResizingFromCenter,
}: {
initialSelectionPageBounds: Box2d
dragDelta: Vec2d
handle: SelectionCorner | SelectionEdge
isAspectRatioLocked: boolean
isResizingFromCenter: boolean
}): SnapData
Parameters
Name | Description |
---|---|
|
|
Returns
SnapData
References
Box2d, Vec2d, SelectionCorner, SelectionEdge
snapTranslate()
Public method
Signature
snapTranslate({
lockedAxis,
initialSelectionPageBounds,
initialSelectionSnapPoints,
dragDelta,
}: {
lockedAxis: 'x' | 'y' | null
initialSelectionSnapPoints: SnapPoint[]
initialSelectionPageBounds: Box2d
dragDelta: Vec2d
}): SnapData
Parameters
Name | Description |
---|---|
|
|
Returns
SnapData
References