[feature] snapping (#168)
* defer cloning * basic snapping * Improves algorithm for snap points, rendering * Improves snapping, snaplines * Enables a clone to snap to its parent * Adds overlay * Fix overlay, zoom scaling for distance and speed
This commit is contained in:
parent
b1b9f901d3
commit
0cfc68b004
38 changed files with 799 additions and 222 deletions
|
@ -12,7 +12,7 @@ import type {
|
|||
import { Canvas } from '../canvas'
|
||||
import { Inputs } from '../../inputs'
|
||||
import { useTLTheme, TLContext, TLContextType } from '../../hooks'
|
||||
import type { TLShapeUtil, TLUsers } from '+index'
|
||||
import type { TLShapeUtil, TLSnapLine, TLUsers } from '+index'
|
||||
|
||||
export interface RendererProps<T extends TLShape, E extends Element = any, M = any>
|
||||
extends Partial<TLCallbacks<T>> {
|
||||
|
@ -40,6 +40,10 @@ export interface RendererProps<T extends TLShape, E extends Element = any, M = a
|
|||
* (optional) The current users to render.
|
||||
*/
|
||||
users?: TLUsers<T>
|
||||
/**
|
||||
* (optional) The current snap lines to render.
|
||||
*/
|
||||
snapLines?: TLSnapLine[]
|
||||
/**
|
||||
* (optional) The current user's id, used to identify the user.
|
||||
*/
|
||||
|
@ -97,6 +101,7 @@ export function Renderer<T extends TLShape, E extends Element, M extends Record<
|
|||
userId,
|
||||
theme,
|
||||
meta,
|
||||
snapLines,
|
||||
containerRef,
|
||||
hideHandles = false,
|
||||
hideIndicators = false,
|
||||
|
@ -132,6 +137,7 @@ export function Renderer<T extends TLShape, E extends Element, M extends Record<
|
|||
id={id}
|
||||
page={page}
|
||||
pageState={pageState}
|
||||
snapLines={snapLines}
|
||||
users={users}
|
||||
userId={userId}
|
||||
hideBounds={hideBounds}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue