Move clearing graph layout into disconnect

This commit is contained in:
ziajka 2018-03-19 15:39:39 +01:00
parent e2bcd72319
commit 7224bade9c
2 changed files with 6 additions and 6 deletions

View File

@ -68,9 +68,7 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
}
ngOnDestroy() {
if (this.svg.empty && !this.svg.empty()) {
this.svg.selectAll('*').remove();
}
this.graphLayout.disconnect(this.svg);
}
ngOnInit() {

View File

@ -5,13 +5,10 @@ import { NodesWidget } from "./nodes.widget";
import { Widget } from "./widget";
import { SVGSelection } from "../../../map/models/types";
import { LinksWidget } from "./links.widget";
import { D3ZoomEvent, zoom } from "d3-zoom";
import { event } from "d3-selection";
import { Drawing } from "../models/drawing.model";
import { DrawingsWidget } from "./drawings.widget";
import { DrawingLineWidget } from "./drawing-line.widget";
import {SelectionTool} from "../tools/selection-tool";
import {Tool} from "../tool";
import {MovingTool} from "../tools/moving-tool";
export class GraphLayout implements Widget {
@ -101,4 +98,9 @@ export class GraphLayout implements Widget {
this.movingTool.draw(view, context);
}
disconnect(view: SVGSelection) {
if (view.empty && !view.empty()) {
view.selectAll('*').remove();
}
}
}