mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-30 05:54:17 +00:00
separate createGraph
This commit is contained in:
parent
01586f500f
commit
778efff79a
@ -10,7 +10,7 @@ import { GraphLayout } from "../../widgets/graph-layout";
|
||||
import { Context } from "../../models/context";
|
||||
import { Size } from "../../models/size";
|
||||
import { Drawing } from "../../models/drawing";
|
||||
import { Symbol } from "../../models/symbol";
|
||||
import { Symbol } from '../../../models/symbol';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -72,11 +72,13 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
ngOnInit() {
|
||||
const d3 = this.d3;
|
||||
|
||||
let rootElement: Selection<HTMLElement, any, null, undefined>;
|
||||
|
||||
if (this.parentNativeElement !== null) {
|
||||
rootElement = d3.select(this.parentNativeElement);
|
||||
this.createGraph(this.parentNativeElement);
|
||||
}
|
||||
}
|
||||
|
||||
public createGraph(domElement: HTMLElement) {
|
||||
const rootElement = this.d3.select(domElement);
|
||||
this.svg = rootElement.select<SVGSVGElement>('svg');
|
||||
|
||||
this.graphContext = new Context(true);
|
||||
@ -98,7 +100,6 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
this.graphLayout.draw(this.svg, this.graphContext);
|
||||
}
|
||||
}
|
||||
|
||||
public getSize(): Size {
|
||||
let width = document.documentElement.clientWidth;
|
||||
|
@ -105,6 +105,7 @@ export class GraphLayout implements Widget {
|
||||
return `translate(${xTrans}, ${yTrans}) scale(${kTrans})`;
|
||||
});
|
||||
|
||||
// @fix me
|
||||
const layersManager = new LayersManager();
|
||||
layersManager.setNodes(this.nodes);
|
||||
layersManager.setDrawings(this.drawings);
|
||||
|
@ -53,6 +53,7 @@ export class LayersWidget implements Widget {
|
||||
.exit()
|
||||
.remove();
|
||||
|
||||
// @FixMe
|
||||
this.graphLayout
|
||||
.getLinksWidget()
|
||||
.draw(links_container);
|
||||
|
Loading…
x
Reference in New Issue
Block a user