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