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
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 = new GraphLayout();
this.graphLayout.getNodesWidget().addOnNodeDraggingCallback((n: Node) => { this.graphLayout.getNodesWidget().addOnNodeDraggingCallback((event: any, n: Node) => {
const linksWidget = this.graphLayout.getLinksWidget(); const linksWidget = this.graphLayout.getLinksWidget();
linksWidget.select(this.svg).each(function(this: SVGGElement, link: Link) { 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) { 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"); return view.selectAll<SVGGElement, Link>("g.link");
} }
public revise(selection: Selection<BaseType, Link, SVGElement, any>) { public revise(selection: SVGSelection) {
const self = this; const self = this;
selection selection
@ -120,7 +120,9 @@ export class LinksWidget implements Widget {
.attr('map-source', (l: Link) => l.source.node_id) .attr('map-source', (l: Link) => l.source.node_id)
.attr('map-target', (l: Link) => l.target.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 link
.exit() .exit()

View File

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