diff --git a/src/app/pages/home/home-page.component.html b/src/app/pages/home/home-page.component.html index b662a64..9d1fa5e 100644 --- a/src/app/pages/home/home-page.component.html +++ b/src/app/pages/home/home-page.component.html @@ -66,7 +66,7 @@ -
+
diff --git a/src/app/pages/home/home-page.component.ts b/src/app/pages/home/home-page.component.ts index daefa1e..c154bdc 100644 --- a/src/app/pages/home/home-page.component.ts +++ b/src/app/pages/home/home-page.component.ts @@ -185,7 +185,6 @@ export class HomePageComponent implements OnInit, OnDestroy { // this.simulationRestart(true); this.simulationRestart(); - this.probeService.send('DiscoveryService.DiscoverHost', requesterID, this.zone, this.discoverHost); } @@ -307,7 +306,52 @@ export class HomePageComponent implements OnInit, OnDestroy { } nodeElements.on('click', function () { - const node = getNodeFromElement(this as Element); + d3.event.stopPropagation(); + + const nodeElement = this as Element; + const node = getNodeFromElement(nodeElement); + if (null === node || 'zone' === node.group) { + return; + } + + if (null === __this.selectedNode) { + __this.selectedNode = node; + nodeElements.each(function () { + const _thisElement = this as Element; + d3.select(_thisElement).classed('semi-unfocused', false); + d3.select(_thisElement).classed('unfocused', false); + }); + + linkElements.each(function () { + const _thisElement = this as Element; + d3.select(_thisElement).classed('semi-unfocused', false); + d3.select(_thisElement).classed('unfocused', false); + }); + + nodeElements.each(function () { + const _thisElement = this as Element; + switch (isConnectedNode(node, _thisElement)) { + case ConnectedNode.CONNECTED: + d3.select(_thisElement).classed('semi-unselected', true); + break; + case ConnectedNode.NOT_CONNECTED: + d3.select(_thisElement).classed('unselected', true); + break; + default: + break; + } + }); + + linkElements.each(function () { + const _thisElement = this as Element; + if (isConnectedLink(node, _thisElement)) { + d3.select(_thisElement).classed('semi-unselected', true); + } else { + d3.select(_thisElement).classed('unselected', true); + } + }); + } + __this.onTargetClick(node); }); @@ -315,11 +359,17 @@ export class HomePageComponent implements OnInit, OnDestroy { const discoveryContainer = d3.select(this.discoveryTargetRef.nativeElement); discoveryContainer.on('click', function () { __this.selectedNode = null; - nodeElements.classed('unselected', function (): boolean { - return false; + + nodeElements.each(function () { + const _thisElement = this as Element; + d3.select(_thisElement).classed('semi-unselected', false); + d3.select(_thisElement).classed('unselected', false); }); - linkElements.classed('unselected', function (): boolean { - return false; + + linkElements.each(function () { + const _thisElement = this as Element; + d3.select(_thisElement).classed('semi-unselected', false); + d3.select(_thisElement).classed('unselected', false); }); }); @@ -377,64 +427,6 @@ export class HomePageComponent implements OnInit, OnDestroy { } }) - .on('mousedown', function () { - const nodeElement = this as Element; - const node = getNodeFromElement(nodeElement); - if (null === node || 'zone' === node.group) { - return; - } - - if (null === __this.selectedNode) { - __this.selectedNode = node; - nodeElements.each(function () { - const _thisElement = this as Element; - d3.select(_thisElement).classed('semi-unfocused', false); - d3.select(_thisElement).classed('unfocused', false); - }); - - linkElements.each(function () { - const _thisElement = this as Element; - d3.select(_thisElement).classed('semi-unfocused', false); - d3.select(_thisElement).classed('unfocused', false); - }); - - nodeElements.each(function () { - const _thisElement = this as Element; - switch (isConnectedNode(node, _thisElement)) { - case ConnectedNode.CONNECTED: - d3.select(_thisElement).classed('semi-unselected', true); - break; - case ConnectedNode.NOT_CONNECTED: - d3.select(_thisElement).classed('unselected', true); - break; - default: - break; - } - }); - - linkElements.each(function () { - const _thisElement = this as Element; - if (isConnectedLink(node, _thisElement)) { - d3.select(_thisElement).classed('semi-unselected', true); - } else { - d3.select(_thisElement).classed('unselected', true); - } - }); - - // const root = d3.select(__this.discoveryTargetRef.nativeElement); - // const zoneRect = root.select('.zone').node().getBoundingClientRect(); - // const nodeRect = d3.select(nodeElement).node().getBoundingClientRect(); - - // const cx = (nodeRect.x - zoneRect.x); - // const cy = (nodeRect.y - zoneRect.y); - - // root - // .transition() - // .duration(500 || 0) // milliseconds - // .call(__this.zoomBehavior.transform, d3.zoomIdentity.translate(cx, cy).scale(1.4)); - - } - }) .on('mouseout', function () { const node = getNodeFromElement(this as Element); diff --git a/src/commons/component/node-detail.component.html b/src/commons/component/node-detail.component.html index 19e9db1..a9a2e4b 100644 --- a/src/commons/component/node-detail.component.html +++ b/src/commons/component/node-detail.component.html @@ -1,6 +1,5 @@
-