From 9e05dfc2e76aa2ff77fb14b0840fc77ea2ba19fe Mon Sep 17 00:00:00 2001 From: Piotr Pekala Date: Fri, 14 Jun 2019 02:47:31 -0700 Subject: [PATCH] Improvement in positioning labels --- .../link-created/link-created.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/components/drawings-listeners/link-created/link-created.component.ts b/src/app/components/drawings-listeners/link-created/link-created.component.ts index b407b624..baa5286c 100644 --- a/src/app/components/drawings-listeners/link-created/link-created.component.ts +++ b/src/app/components/drawings-listeners/link-created/link-created.component.ts @@ -49,21 +49,21 @@ export class LinkCreatedComponent implements OnInit, OnDestroy { if ((linkCreated.sourceNode.x <= linkCreated.targetNode.x) && (linkCreated.sourceNode.y <= linkCreated.targetNode.y)) { xLabelSourceNode = Math.floor(linkCreated.sourceNode.width/2) + Math.round(x) + 5; yLabelSourceNode = Math.floor(linkCreated.sourceNode.height/2) + Math.round(y) + 5; - xLabelTargetNode = Math.floor(linkCreated.targetNode.width/2) - Math.round(x) - 15; - yLabelTargetNode = Math.floor(linkCreated.targetNode.height/2) - Math.round(y) - 15; + xLabelTargetNode = Math.floor(linkCreated.targetNode.width/2) - Math.round(x) - 25; + yLabelTargetNode = Math.floor(linkCreated.targetNode.height/2) - Math.round(y) - 25; } else if ((linkCreated.sourceNode.x > linkCreated.targetNode.x) && (linkCreated.sourceNode.y < linkCreated.targetNode.y)) { xLabelSourceNode = Math.floor(linkCreated.sourceNode.width/2) - Math.round(x) - 15; yLabelSourceNode = Math.floor(linkCreated.sourceNode.height/2) + Math.round(y) + 15; xLabelTargetNode = Math.floor(linkCreated.targetNode.width/2) + Math.round(x) + 5; yLabelTargetNode = Math.floor(linkCreated.targetNode.height/2) - Math.round(y) - 5; } else if ((linkCreated.sourceNode.x < linkCreated.targetNode.x) && (linkCreated.sourceNode.y > linkCreated.targetNode.y)) { - xLabelSourceNode = Math.floor(linkCreated.sourceNode.width/2) + Math.round(x) + 15; - yLabelSourceNode = Math.floor(linkCreated.sourceNode.height/2) - Math.round(y) - 15; + xLabelSourceNode = Math.floor(linkCreated.sourceNode.width/2) + Math.round(x) + 25; + yLabelSourceNode = Math.floor(linkCreated.sourceNode.height/2) - Math.round(y) - 25; xLabelTargetNode = Math.floor(linkCreated.targetNode.width/2) - Math.round(x) - 5; yLabelTargetNode = Math.floor(linkCreated.targetNode.height/2) + Math.round(y) + 5; } else if ((linkCreated.sourceNode.x >= linkCreated.targetNode.x) && (linkCreated.sourceNode.y >= linkCreated.targetNode.y)) { - xLabelSourceNode = Math.floor(linkCreated.sourceNode.width/2) - Math.round(x) - 15; - yLabelSourceNode = Math.floor(linkCreated.sourceNode.height/2) - Math.round(y) - 15; + xLabelSourceNode = Math.floor(linkCreated.sourceNode.width/2) - Math.round(x) - 25; + yLabelSourceNode = Math.floor(linkCreated.sourceNode.height/2) - Math.round(y) - 25; xLabelTargetNode = Math.floor(linkCreated.targetNode.width/2) + Math.round(x) + 5; yLabelTargetNode = Math.floor(linkCreated.targetNode.height/2) + Math.round(y) + 5; }