Skip to content
D
Documentation

DomEventBinder

reference
1 min readUpdated

Import it from @grafloria/renderer.

ts
class DomEventBinder

Methods

  • getDraggingNodeIds(): string[] — . The nodes currently being DRAGGED (past the movement threshold — an armed-but-uncommitted press is a click, not a drag).
  • hasActiveGesture(): boolean — True while a resize / rotate / vertex gesture owns the pointer.
  • constructor( private readonly container: HTMLElement, private readonly host: DomEventBinderHost, options: DomEventBinderOptions = {} )
  • setReadonly(readonly: boolean): void — Flip the readonly option live (the instance's setReadonly). A view-level switch: it refuses gestures and editing keys, but leaves the document writable to code — the model's own lock is untouched.
  • readonlyNow(): boolean — The answer every gesture consults: the option, or the document's lock.
  • startConnectionFromPort(portId: string, clientX: number, clientY: number): boolean — Start a connection drag from portId at a client point — what a press on the port itself does, for a control that stands in for the port (the affordances' "+"). The rest of the gesture is the binder's as usual: the preview line, snapping, the reason label, connect or connect:drop-empty.
  • attach(): void — Bind DOM listeners. No-op on the server and no-op if already attached.
  • detach(): void — Remove EXACTLY the listeners we added, and drop all gesture state.
  • get isAttached(): boolean
  • onWheel(event: WheelEvent): void
  • onMouseDown(event: MouseEvent): void
  • onMouseMove(event: MouseEvent): void
  • onMouseUp(event: MouseEvent): void
  • onMouseLeave(): void — Pointer left the canvas — abort every in-flight gesture so nothing sticks.
  • onDoubleClick(event: MouseEvent): void — Double-click: node → in-place rename; link label → rename; link body → waypoint.
  • onKeyDown(event: KeyboardEvent): void
  • onKeyUp(event: KeyboardEvent): void
  • beginLabelEdit(target: TextEditTarget, options?: { seed?: string }): boolean — Open the in-place label editor programmatically — the seam behind F2 and a host's context-menu Rename. Unlike the double-click path this is NOT gated on enableInPlaceTextEdit: an explicit call IS the host's opt-in. Returns false when the target does not exist / is not editable / readonly.

Was this page helpful?