File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
packages/joint-layout-directed-graph Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,14 @@ export namespace DirectedGraph {
4141 [ key : string ] : any ;
4242 }
4343
44+ interface fromGraphLibOptions {
45+ graph ?: dia . Graph ;
46+ [ key : string ] : any ;
47+ }
48+
4449 export function layout ( graph : dia . Graph | dia . Cell [ ] , opt ?: LayoutOptions ) : g . Rect ;
4550
4651 export function toGraphLib ( graph : dia . Graph , opt ?: toGraphLibOptions ) : any ;
4752
48- export function fromGraphLib ( glGraph : any , opt ?: { [ key : string ] : any } ) : dia . Graph ;
53+ export function fromGraphLib ( glGraph : any , opt ?: fromGraphLibOptions ) : dia . Graph ;
4954}
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ export const DirectedGraph = {
173173 graph . startBatch ( 'layout' ) ;
174174
175175 DirectedGraph . fromGraphLib ( glGraph , {
176+ graph,
176177 importNode : opt . importNode ,
177178 importEdge : opt . importEdge ,
178179 setPosition : opt . setPosition ,
@@ -217,7 +218,7 @@ export const DirectedGraph = {
217218
218219 var importNode = opt . importNode || util . noop ;
219220 var importEdge = opt . importEdge || util . noop ;
220- var graph = new dia . Graph ( ) ;
221+ var graph = opt . graph || new dia . Graph ( ) ;
221222
222223 // Import all nodes.
223224 glGraph . nodes ( ) . forEach ( function ( node ) {
You can’t perform that action at this time.
0 commit comments