Merge pull request #53 from GNS3/restore-functionalities

Restore functionality, Fixes: #50
This commit is contained in:
ziajka 2018-01-19 11:11:56 +01:00 committed by GitHub
commit e563dd6381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -95,7 +95,7 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
this.graphLayout = new GraphLayout();
this.graphLayout.getNodesWidget().addOnNodeDraggingCallback((n: Node) => {
this.graphLayout.getNodesWidget().addOnNodeDraggingCallback((event: any, n: Node) => {
const linksWidget = this.graphLayout.getLinksWidget();
linksWidget.select(this.svg).each(function(this: SVGGElement, link: Link) {
if (link.target.node_id === n.node_id || link.source.node_id === n.node_id) {

View File

@ -23,7 +23,7 @@ export class LinksWidget implements Widget {
return view.selectAll<SVGGElement, Link>("g.link");
}
public revise(selection: Selection<BaseType, Link, SVGElement, any>) {
public revise(selection: SVGSelection) {
const self = this;
selection
@ -120,7 +120,9 @@ export class LinksWidget implements Widget {
.attr('map-source', (l: Link) => l.source.node_id)
.attr('map-target', (l: Link) => l.target.node_id)
//this.revise(link.merge(link_enter));
const merge = link.merge(link_enter);
this.revise(merge);
link
.exit()

View File

@ -30,7 +30,7 @@ export class NodesWidget implements Widget {
this.onNodeDraggedCallback = onNodeDraggedCallback;
}
public addOnNodeDraggingCallback(onNodeDraggingCallback: (n: Node) => void) {
public addOnNodeDraggingCallback(onNodeDraggingCallback: (event: any, n: Node) => void) {
this.onNodeDraggingCallbacks.push(onNodeDraggingCallback);
}
@ -38,10 +38,10 @@ export class NodesWidget implements Widget {
this.symbols = symbols;
}
private executeOnNodeDraggingCallback(n: Node) {
// this.onNodeDraggingCallbacks.forEach((callback: (n: Node) => void) => {
// callback(n);
// });
private executeOnNodeDraggingCallback(callback_event: any, node: Node) {
this.onNodeDraggingCallbacks.forEach((callback: (e: any, n: Node) => void) => {
callback(callback_event, node);
});
}
public revise(selection: SVGSelection) {
@ -157,7 +157,7 @@ export class NodesWidget implements Widget {
n.y = e.y;
self.revise(select(this));
self.executeOnNodeDraggingCallback(n);
self.executeOnNodeDraggingCallback(event, n);
};
const dragging = () => {