tldraw
Version:
A tiny little drawing editor.
22 lines (19 loc) • 645 B
text/typescript
// shared custody
import { StateNode, TLStateNodeConstructor } from '@tldraw/editor'
import { Drawing } from '../draw/toolStates/Drawing'
import { Idle } from '../draw/toolStates/Idle'
/** @public */
export class HighlightShapeTool extends StateNode {
static override id = 'highlight'
static override initial = 'idle'
static override useCoalescedEvents = true
static override children(): TLStateNodeConstructor[] {
return [Idle, Drawing]
}
static override isLockable = false
override shapeType = 'highlight'
override onExit() {
const drawingState = this.children!['drawing'] as Drawing
drawingState.initialShape = undefined
}
}