diff --git a/src/components/graph.ts b/src/components/graph.ts index cf5b460..849ffbc 100644 --- a/src/components/graph.ts +++ b/src/components/graph.ts @@ -98,6 +98,7 @@ export class Graph { this._graph.on(G6CanvasEvent.CLICK, this._onCanvasClick.bind(this)); this._graph.on(G6NodeEvent.CONTEXT_MENU, this._onContextMenu.bind(this)); this._graph.on(G6NodeEvent.CLICK, this._onClick.bind(this)); + this._graph.on(G6NodeEvent.DBLCLICK, this._onDblClick.bind(this)); this._graph.on(G6NodeEvent.DRAG_START, this._onDragStart.bind(this)); this._graph.on(G6NodeEvent.DRAG_END, this._onDragEnd.bind(this)); this._graph.on(G6NodeEvent.DRAG_ENTER, this._onDragEnter.bind(this)); @@ -562,6 +563,11 @@ export class Graph { this.selectNode(e.target.id); } + private _onDblClick(e: IG6PointerEvent) { + this.selectNode(e.target.id); + this.editSubtree(); + } + private _isDragState(state: string): boolean { return ( state === "dragsrc" || state === "dragup" || state === "dragdown" || state === "dragright"