@mocanvas/editor · class
declare abstract class BindingUtil<B extends UnknownBinding = UnknownBinding>Describes how a binding type behaves. One instance per binding type per editor. Callbacks run inside the store transaction that caused them.
Methods · 3
constructor(editor: Editor)abstract getDefaultProps(): Partial<B["props"]>get type(): B["type"]Properties · 17
canBind?(options: BindingCanBindOptions): booleanWhether this binding type may connect these two shapes.
Consulted alongside ShapeUtil.canBind, which asks the same question from
the shape's side; both must say yes.
readonly editor: Editorstatic migrations?: unknownonAfterChange?(options: BindingOnChangeOptions<B>): voidonAfterChangeFromShape?(options: BindingOnShapeChangeOptions<B>): voidThe from shape changed (moved, resized, ...).
onAfterChangeToShape?(options: BindingOnShapeChangeOptions<B>): voidThe to shape changed.
onAfterCreate?(options: BindingOnCreateOptions<B>): voidonAfterDelete?(options: BindingOnDeleteOptions<B>): voidonBeforeChange?(options: BindingOnChangeOptions<B>): B | voidonBeforeCreate?(options: BindingOnCreateOptions<B>): B | voidonBeforeDelete?(options: BindingOnDeleteOptions<B>): voidonBeforeDeleteFromShape?(options: BindingOnShapeDeleteOptions<B>): voidThe from shape is about to be deleted; the binding is deleted right after.
onBeforeDeleteToShape?(options: BindingOnShapeDeleteOptions<B>): voidThe to shape is about to be deleted; the binding is deleted right after.
onBeforeIsolateFromShape?(options: BindingOnShapeIsolateOptions<B>): voidThe from shape is being isolated (partner going away); typically the binding converts to a static value.
onBeforeIsolateToShape?(options: BindingOnShapeIsolateOptions<B>): voidstatic props?: UnknownRecordPropsOne validator per prop of the binding this util describes — the contract
the store checks a record against before it is written, and what
createSchema() reads to build the document schema. A binding type that
declares none is not validated: see createBindingRecordType.
static type: stringmocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.