Move constants to options prop (#3799)
Another go at #3628 & #3783. This moves (most) constants into `editor.options`, configurable by the `options` prop on the tldraw component. ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `feature` — New feature ### Release Notes You can now override many options which were previously hard-coded constants. Pass an `options` prop into the tldraw component to change the maximum number of pages, grid steps, or other previously hard-coded values. See `TldrawOptions` for more
This commit is contained in:
parent
19f8d4248c
commit
a457a39081
37 changed files with 347 additions and 267 deletions
|
@ -1,6 +1,7 @@
|
|||
import { TLHandle, TLShapeId } from '@tldraw/tlschema'
|
||||
import classNames from 'classnames'
|
||||
import { COARSE_HANDLE_RADIUS, HANDLE_RADIUS, SIDES } from '../../constants'
|
||||
import { SIDES } from '../../constants'
|
||||
import { useEditor } from '../../hooks/useEditor'
|
||||
|
||||
/** @public */
|
||||
export interface TLHandleProps {
|
||||
|
@ -13,7 +14,8 @@ export interface TLHandleProps {
|
|||
|
||||
/** @public */
|
||||
export function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps) {
|
||||
const br = (isCoarse ? COARSE_HANDLE_RADIUS : HANDLE_RADIUS) / zoom
|
||||
const editor = useEditor()
|
||||
const br = (isCoarse ? editor.options.coarseHandleRadius : editor.options.handleRadius) / zoom
|
||||
|
||||
if (handle.type === 'clone') {
|
||||
// bouba
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue