import { loadDefaultGraph , layoutGeomGraph , loadDotFile } from './load-data' ; import { dropZone } from './drag-n-drop' ; import Renderer from './renderer' ; import { DrawingGraph } from 'msagl-js/dist/src/drawing' ; import { measureTextSize } from './load-data' ; import { Graph , GeomGraph } from 'msagl-js/dist/src' ; const renderer = new Renderer ( ) ; function render ( g ) { document . getElementById ( 'graph-name' ) . innerText = g . id ; console . log ( GeomGraph . getGeom ( g ) as GeomGraph ) ; renderer . setGraph ( GeomGraph . getGeom ( g ) as GeomGraph ) ; } dropZone ( 'drop-target' , async ( f ) => { const graph = await loadDotFile ( f ) ; renderDrawingGraph ( graph ) ; document . getElementById ( 'graph-name' ) . innerText = graph . graph . id ; } ) ; ( async ( ) => { const g = await loadDefaultGraph ( ) ; render ( g ) ; } ) ( ) ; function renderDrawingGraph ( dg ) { dg . createGeometry ( measureTextSize ) ; layoutGeomGraph ( < GeomGraph > GeomGraph . getGeom ( dg . graph ) , dg . hasDirectedEdge ( ) ) ; renderer . setGraph ( GeomGraph . getGeom ( dg . graph ) as GeomGraph ) ; }