From a59d2c3b13fae888b259417838bcdba94ddf9e7d Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 12 Sep 2018 21:55:43 +0900 Subject: [PATCH] ing --- src/app/pages/home/home-page.component.ts | 52 ++++++++--- src/assets/image/logo/logo_tomcat.svg | 100 +++++++++++----------- 2 files changed, 87 insertions(+), 65 deletions(-) diff --git a/src/app/pages/home/home-page.component.ts b/src/app/pages/home/home-page.component.ts index 11efc48..efd82a1 100644 --- a/src/app/pages/home/home-page.component.ts +++ b/src/app/pages/home/home-page.component.ts @@ -221,20 +221,44 @@ export class HomePageComponent implements OnInit, OnDestroy { // d3.select(this.discoveryTargetRef.nativeElement).selectAll('.node-container').call(d3.drag().on('start', started)); - // d3.drag() - // .on('dragstart', (node: Node, i: number) => { - // __this.simulation.stop(); - // }) - // .on('drag', (node: Node, i: number) => { - // node.fx += d3.event.dx; - // node.fy += d3.event.dy; - // node.x += d3.event.dx; - // node.y += d3.event.dy; - // }) - // .on('dragend', (node: Node, i: number) => { - // __this.simulation.stop(); - // }) - // ; + // d3.select(this.discoveryTargetRef.nativeElement).selectAll('.node-container').call( + // d3.drag() + // .on('start', (node: Node, i: number) => { + // __this.simulation.stop(); + // }) + // .on('drag', (node: Node, i: number) => { + // node.fx += d3.event.dx; + // node.fy += d3.event.dy; + // node.x += d3.event.dx; + // node.y += d3.event.dy; + // }) + // .on('end', (node: Node, i: number) => { + // __this.simulation.stop(); + // }) + // ); + + d3.select(this.discoveryTargetRef.nativeElement).selectAll('.node-container').call( + d3.drag() + .on('start', function () { + d3.event.sourceEvent.stopPropagation(); + + if (!d3.event.active) { + __this.simulation.alphaTarget(0.3).restart(); + } + + d3.event.on('drag', dragged).on('end', ended); + + function dragged() { + d3.select(this).attr('cx', d3.event.x).attr('cy', d3.event.y); + } + + function ended() { + if (!d3.event.active) { + __this.simulation.alphaTarget(0); + } + } + }) + ); } diff --git a/src/assets/image/logo/logo_tomcat.svg b/src/assets/image/logo/logo_tomcat.svg index 2c91d00..ef60993 100644 --- a/src/assets/image/logo/logo_tomcat.svg +++ b/src/assets/image/logo/logo_tomcat.svg @@ -1,51 +1,49 @@ - - - - - - - - - - - - - + + + + + + + + + + +