[improvement] export scribble manager (#1671)

This PR adds the `ScribbleManager` to the exports from `@tldraw/editor`.

### Change Type

- [x] `minor` — New feature


### Release Notes

- [@tldraw/tldraw] Export `ScribbleManager`
This commit is contained in:
Steve Ruiz 2023-06-29 15:10:54 +01:00 committed by GitHub
parent 352c19fcac
commit 6faef733b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 0 deletions

View file

@ -1870,6 +1870,43 @@ export const runtime: {
hardReset: () => void;
};
// @public (undocumented)
export class ScribbleManager implements TLScribble {
constructor(opts: {
onUpdate: (scribble: TLScribble) => void;
onComplete: () => void;
size?: TLScribble['size'];
color?: TLScribble['color'];
opacity?: TLScribble['opacity'];
delay?: TLScribble['delay'];
});
addPoint: (x: number, y: number) => void;
// (undocumented)
color: "accent" | "black" | "laser" | "muted-1" | "selection-fill" | "selection-stroke" | "white";
// (undocumented)
delay: number;
// (undocumented)
delayRemaining: number;
getScribble(): TLScribble;
// (undocumented)
opacity: number;
// (undocumented)
pause: () => void;
// (undocumented)
points: Vec2dModel[];
// (undocumented)
resume: () => void;
// (undocumented)
size: number;
// (undocumented)
state: "active" | "paused" | "starting" | "stopping";
stop: () => void;
// (undocumented)
tick: TLTickEvent;
// (undocumented)
timeoutMs: number;
}
// @internal (undocumented)
export function setDefaultEditorAssetUrls(assetUrls: TLEditorAssetUrls): void;

View file

@ -90,6 +90,7 @@ export {
ExternalContentManager as PlopManager,
type TLExternalContent,
} from './lib/editor/managers/ExternalContentManager'
export { ScribbleManager } from './lib/editor/managers/ScribbleManager'
export { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'
export {
ShapeUtil,

View file

@ -2,6 +2,7 @@ import { Vec2d, VecLike } from '@tldraw/primitives'
import { TLScribble, Vec2dModel } from '@tldraw/tlschema'
import { TLTickEvent } from '../types/event-types'
/** @public */
export class ScribbleManager implements TLScribble {
// Scribble properties
state